Forums / Templates, Stylesheets, Page Layout / Custom PHP in shopping cart

Custom PHP in shopping cart

Views: 520

Results 1 to 2 of 2
12 Dec 2011, 6:08 PM
#1
cilaes avatar

cilaes

New Zenner

Join Date:
Dec 2011
Posts:
8
Plugin Contributions:
0

Custom PHP in shopping cart

I'm implementing the "Quantity Discount" module into my cart from a user on this forum, however I can't seem to get it to display the discounts inside the shopping cart so I figured I could make a quick work around since I only have a few products and they're the same price.

When editing tpl_shopping_cart_default.php I decided to just create my own logical statements to display that they will be receiving the discount BEFORE checkout. However, anytime I throw in a new logic statement the cart doesn't display anything.

<?php echo SUB_TITLE_SUB_TOTAL; ?><br>
<?php $cntContents = $_SESSION['cart']->count_contents(); ?>
Total Items: <?php echo $cntContents; ?>

<h2><?php echo $cartShowTotal; ?></h2><br />

Works fine.

<?php echo SUB_TITLE_SUB_TOTAL; ?><br>
<?php $cntContents = $_SESSION['cart']->count_contents(); ?>
Total Items: <?php echo $cntContents; ?>

<?php
if($cntContents == 3) {
	echo '<br>Discount One<br>';
}
?>

<h2><?php echo $cartShowTotal; ?></h2><br />

Makes the whole cart go blank, like an error occurred... Also how can I get RAW total data?

13 Dec 2011, 8:02 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,733
Plugin Contributions:
56

Re: Custom PHP in shopping cart

If you want Quantity Discounts, just download my contribution.

http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_61&products_id=235

Back out all your changes; they are unnecessary.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.