Dirty Butter Posted April 10, 2015 Share Posted April 10, 2015 Bsmither helped me a long time ago add some extra columns to the Products Summary page in Admin. products.index.php <!-- MY SALE PRICE --> <td>{$product.sale_price}</td> <!-- END MY SALE PRICE --> <td align="center">{$product.stock_level}</td> <!-- MY DISCOUNT IMAGE --> <td align="center"><img src="admin/skins/default/images/{if $product.discount}1{else}0{/if}.png" class="toggle" /></td> <!-- END MY DISCOUNT IMAGE --> I tried to search for the original thread, but no luck. The code above is getting the "empty box" 0.png image, whether an item has a quantity discount in use or not. Both images, 1.png and 0.png, are available for use. This was working before v6. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 10, 2015 Share Posted April 10, 2015 There may have been an additional edit to /admin/sources/products.index.inc.php that would determine if the product has a quantity pricing schedule and add a true/false value to the 'discount' array element for the $product array. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 10, 2015 Author Share Posted April 10, 2015 I'll look back through some old v5 backup copies I have and see if I can find it. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 10, 2015 Share Posted April 10, 2015 There is this:http://www.cubecartforums.org/lofiversion/index.php?t17309.html Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 10, 2015 Author Share Posted April 10, 2015 I found this in an old v5 version of products.index.inc.php, but it crashed the Products summary page when I tried to use it. $updated_time = $result['updated']; $result['updated'] = $updated_time ? $updated_time : $lang['common']['unknown']; $smarty_data['products'][] = $result; } /* CHECK FOR QUANTITY DISCOUNTS */ $quanDiscount = $GLOBALS['db']->count('CubeCart_pricing_quantity', 'product_id', array('product_id' => $result['product_id'])); $result['discount'] = ($quanDiscount) ? true : false; $smarty_data['products'][] = $result; } /* END CHECK FOR QUANTITY DISCOUNTS */ $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); $GLOBALS['smarty']->assign('PAGINATION', $pagination); Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 10, 2015 Share Posted April 10, 2015 Was: $updated_time = $result['updated']; $result['updated'] = $updated_time ? $updated_time : $lang['common']['unknown']; $smarty_data['products'][] = $result; } $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); Now: $updated_time = $result['updated']; $result['updated'] = $updated_time ? $updated_time : $lang['common']['unknown']; /* CHECK FOR QUANTITY DISCOUNTS */ $quanDiscount = $GLOBALS['db']->count('CubeCart_pricing_quantity', 'product_id', array('product_id' => $result['product_id'])); $result['discount'] = ($quanDiscount) ? true : false; /* END CHECK FOR QUANTITY DISCOUNTS */ $smarty_data['products'][] = $result; } $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 10, 2015 Author Share Posted April 10, 2015 Just now seeing your link to the original conversation. Your change to the code did not crash the page. Will need to stop for tonight and try clearing everything before I test again. Thanks! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 11, 2015 Author Share Posted April 11, 2015 I've had time to go through all the discussion on the 3rd party forum and clear cache, but it still is only giving the empty box image.I do not use the option matrix at all. I thought maybe debug would give a clue, but there is no warning of any kind.SELECT SQL_CALC_FOUND_ROWS MAX(stock_level) AS max_stock, MIN(stock_level) AS min_stock FROM `CubeCart_option_matrix` WHERE CubeCart_option_matrix.product_id = '1714' AND CubeCart_option_matrix.use_stock = '1' AND CubeCart_option_matrix.status = '1' LIMIT 1; Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 11, 2015 Share Posted April 11, 2015 The conversation is dealing with getting the presence or absence of a quantity price schedule to be indicated in the list.This is not related to whether or not a product's options are being managed via the Options Matrix table. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 11, 2015 Share Posted April 11, 2015 At the bottom of the admin template products.index.php, add {debug}.When you next visit admin, Products, your browser should give you a popup window. Scroll to the lower-case $product at the bottom of the window and look for a 'discount' element. If 'discount' is not there, then the edit made above (there are no post #'s in these new forums) is still not correct. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 11, 2015 Author Share Posted April 11, 2015 No, it's not there:>value = Array (51) product_id => "1584" product_code => "02ASD051108x22" quantity => "1" description => "<p> Playskool Plush Stuffed Large T..." price => "5.00" name => "Playskool Dress Me Blond Doll Dressy ..." cat_id => "138" popularity => "2152" sale_price => "0.00" cost_price => "0.00" stock_level => "4" stock_warning => "0" use_stock_level => "1" digital => "0" digital_path => "" product_weight => "0.630" tax_type => "1" featured => "1" seo_meta_title => "Playskool Dress Me Blond Doll Dressy ..." seo_meta_description => "Playskool Plush Stuffed Large Teach M..." seo_meta_keywords => "Playskool,plush,lovy,lovey,lovie,soft..." prod_sefurl => "" product_notes => "<p><i>\r</i><i>\n</i><i>\t</i>4?</p><i>\r</i><i>\n</i>" hidden => "0" giftcard => "0" tax_inclusive => "0" date_added => "2011-08-22 15:59:34" updated => "2014-11-17 17:27:33" upc => "" ean => "" jan => "" isbn => "" google_product_category => "Toys & Games > Toys > Dolls, Playsets..." status => "1" manufacturer => "223" condition => "used" brand => "" gtin => "" mpn => "" google_category => "Toys & Games > Toys > Dolls, Playsets..." minimum_quantity => "0" available => "1" link_preview => "index.php?_a=product&product_id=1584" link_clone => "https://dirtybutter.com/plushcatalog/..." link_edit => "https://dirtybutter.com/plushcatalog/..." link_delete => "https://dirtybutter.com/plushcatalog/..." type_icon => "admin/skins/default/images/prod_type_..." type_alt => "Tangible" category => "Dolls/Other Doll Brands" image_path_tiny => "/plushcatalog/images/cache/Group_Doll..." image_path_large => "/plushcatalog/images/cache/Group_Doll..."->nocache = false->scope = "file:templates/products.index.php"->_loop = true->key = 19 Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 11, 2015 Author Share Posted April 11, 2015 And we DEFINITELY need comment #'s!! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 19, 2016 Author Share Posted March 19, 2016 I've tried fiddling with this code again, and never have been able to get a toggle image to show in v6 for those products that have a quantity discount. Here's the current code in products.index.php: <!-- BSMITHER DISCOUNT IMAGE --> <td align="center"><img src="{$STORE_URL}/{$SKIN_VARS.admin_folder}/skins/default/images/{if $product.discount}1{else}0{/if}.png" class="toggle" /></td> <td> <!-- END BSMITHER DISCOUNT IMAGE --> $product.discount does not show in the Array at the bottom of the Debug popup. If there were some way to get the 1.png image to show if $discount.discount_id is greater than zero, then it seems like it would work. But I've tried using that string instead of $product.discount, and it did not work for me. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 19, 2016 Share Posted March 19, 2016 We need to verify the code in product.index.inc.php is correct. /* CHECK FOR QUANTITY DISCOUNTS */ $quanDiscount = $GLOBALS['db']->count('CubeCart_pricing_quantity', 'product_id', array('product_id' => $result['product_id'])); $result['discount'] = ($quanDiscount) ? true : false; /* END CHECK FOR QUANTITY DISCOUNTS */ $smarty_data['products'][] = $result; Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 19, 2016 Author Share Posted March 19, 2016 This is what I have in product.index.inc.php. Your code looks the same, but line below is different?? Did I put it in the wrong place?? /* BSMITHER CHECK FOR QUANTITY DISCOUNTS */ $quanDiscount = $GLOBALS['db']->count('CubeCart_pricing_quantity', 'product_id', array('product_id' => $result['product_id'])); $result['discount'] = ($quanDiscount) ? true : false; /* BSMITHER END CHECK FOR QUANTITY DISCOUNTS */ $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 19, 2016 Share Posted March 19, 2016 Find: $smarty_data['products'][] = $result; } $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); Add ABOVE: /* CHECK FOR QUANTITY DISCOUNTS */ $quanDiscount = $GLOBALS['db']->count('CubeCart_pricing_quantity', 'product_id', array('product_id' => $result['product_id'])); $result['discount'] = ($quanDiscount) ? true : false; /* END CHECK FOR QUANTITY DISCOUNTS */ Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 19, 2016 Author Share Posted March 19, 2016 That was it! Just a stupid mistake in upgrading my edits from v5 to v6. I always appreciate your patience!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.