Page 1 of 1
Items aren't added to cart
Posted: Wed Oct 21, 2015 9:14 am
by Frescard
I just set up my first opencart installation, and everything seems to work just fine, except for some minor detail — I cannot add anything to the cart...
It doesn't matter if I do it from a listings page or from the individual product page, once I click the "add to cart" button, there's a little delay (and "Loading" might flash on the button or the cart status), and then it goes back. No error message on the screen or in the log (php error logging is enabled).
I modified some of the template to hide certain elements (e.g. the model and price lines), but that was mainly on the product page, so I don't know if that would affect the cart function on the listing pages.
The site is here:
http://popcorncafe.ca/shop
(All the configurations are done
without the www prefix, so that is probably not the culprit.)
Re: Items aren't added to cart
Posted: Wed Oct 21, 2015 3:27 pm
by uksitebuilder
I can see the site has been modded slightly (no search box)
You should re-upload the default files as there is no bug wit hthe add to cart function by default.
Re: Items aren't added to cart
Posted: Wed Oct 21, 2015 4:27 pm
by pprmkr
Frescard wrote: I modified some of the template to hide certain elements (e.g. the model and price lines)
Commented out price : NOT OK -> causes div id product beiing commented out and as a result data is not send with button-cart click function.
Code: Select all
<?php if ($price) { ?>
<ul class="list-unstyled">
<!--
<?php if (!$special) { ?>
<li>
<h2><?php echo $price; ?></h2>
</li>
<?php } else { ?>
<li><span style="text-decoration: line-through;"><?php echo $price; ?></span></li>
<li>
<h2><?php echo $special; ?></h2>
</li>
-->
<?php } ?>
<?php if ($tax) { ?>
<li><?php echo $text_tax; ?> <?php echo $tax; ?></li>
<?php } ?>
<?php if ($points) { ?>
<li><?php echo $text_points; ?> <?php echo $points; ?></li>
<?php } ?>
<?php if ($discounts) { ?>
<li>
<hr>
</li>
<?php foreach ($discounts as $discount) { ?>
<li><?php echo $discount['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?></li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
Move --> 1 line lower after <?php } ?>
Then price is commented out, special or not.
But tax, points and discounts will be visible.
Re: Items aren't added to cart
Posted: Wed Oct 21, 2015 10:01 pm
by viethemes
Frescard wrote:I just set up my first opencart installation, and everything seems to work just fine, except for some minor detail — I cannot add anything to the cart...
It doesn't matter if I do it from a listings page or from the individual product page, once I click the "add to cart" button, there's a little delay (and "Loading" might flash on the button or the cart status), and then it goes back. No error message on the screen or in the log (php error logging is enabled).
I modified some of the template to hide certain elements (e.g. the model and price lines), but that was mainly on the product page, so I don't know if that would affect the cart function on the listing pages.
The site is here:
http://popcorncafe.ca/shop
(All the configurations are done
without the www prefix, so that is probably not the culprit.)
Because of
https://en.wikipedia.org/wiki/Same-origin_policy, you should use one type url only www or non-www.
Re: Items aren't added to cart
Posted: Thu Oct 22, 2015 5:19 am
by Frescard
pprmkr wrote:
Move --> 1 line lower after <?php } ?>
Thanks for the hint! I've modified it per your suggestions, and it now works.
But it seemed to have been more an issue of unbalanced brackets than a commented-out price, no?
Because once I move the comment-close tag, the price is
still invisible, but the cart-adding works fine now.