Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

want to disable checkout button when price reads zero


evbeej

Recommended Posts

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

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

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...