A customer asked if there was a way to force a customer to purchase a single cooler, only if they have at least one perishable food item in their cart.

This hack accomplishes that in versions 2.5.0 and newer.

1. You need a custom theme for this, and it needs to be set as your store's default theme. If you haven't done that already, read the instructions here:
http://squirrelcart.com/help/?Modify...Templates.html

2. Make sure all refrigerated items are in a category that only contains refrigerated items. If you don't already have it setup this way, create a new category named "refrigerated", and add all these items to it. Write down this category's record number.

3. Create a regular product record for the cooler you referred to (not a product option). Write down this product's record number.

4. Put a copy of "squirrelcart/themes/squirrelcart/view_cart.tpl.php" into your custom theme folder

5. Open that file in an editor

6. Paste this at the top of the file:

PHP Code:
<?php
$refrig_category     
205;        // record number of refrigerable category 
$cooler_rn             392;        // record number of cooler product record

$cooler_URL            get_product_url($cooler_rn);

if (
qty_in_cart($refrig_category,'category') && !qty_in_cart($cooler_rn,'product')) {
    print 
"The items in your cart require refrigeration. You must purchase a <a href=\"$cooler_URL\">cooler</a> to complete this order.";
    return;
}
?>
7. Edit the value of $refrig_category, changing 205 to the category record number you created in your cart

8. Edit the value of $cooler_rn, changing the 392 to match the cooler product's record number

9. Save the file.

During checkout, the customer will be forced to purchase a cooler before they can complete their order.