evbeej Posted September 11, 2015 Share Posted September 11, 2015 Hello, I have a shop that occasionally has prices errors which result in some products going through to the shopping cart as zero. I have written code to hide the checkout button on the shopping cart if there is a zero price. However i need a way to divert the checkout button along the top to the shopping cart page instead of going straight to shipping when the zero price is detected. When there is no zero we are happy to have it continue pointing to shipping. Any help would be greatly appreciated! Thank you. Link to comment Share on other sites More sharing options...
evbeej Posted September 11, 2015 Author Share Posted September 11, 2015 I have resolved this with a (probably very messy) bit of code. I created a new button that when some code reads 0 within the cart it replaced the current button with another 'checkout error' button: $products = $cart->get_products();$zeroPricePresent = 0;for ($i=0, $n=sizeof($products); $i<$n; $i++) {if ($products[$i]['final_price'] == 0.00) { echo tep_draw_button(HEADER_TITLE_CHECKOUT_ERROR, 'alert', tep_href_link(FILENAME_SHOPPING_CART));$zeroPricePresent = 1;break; } } if ($zeroPricePresent === 0) {echo tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));} else {echo "";} Link to comment Share on other sites More sharing options...
clustersolutions Posted September 11, 2015 Share Posted September 11, 2015 wouldn't being proactive and fixing the price errors be better? I have a shop that occasionally has prices errors... Link to comment Share on other sites More sharing options...
evbeej Posted September 11, 2015 Author Share Posted September 11, 2015 wouldn't being proactive and fixing the price errors be better? Of course it would be better to fix the cause, the prices are added through another program which is dealt with by someone else. I was asked to set up something that would catch the zeros until the real issue could be resolved. Link to comment Share on other sites More sharing options...
clustersolutions Posted September 11, 2015 Share Posted September 11, 2015 Ah...gotcha! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.