For those familiar with Opencart, on my website's cart page the "apply coupon," "apply shipping" and update item total buttons (the refresh symbol) aren't functioning. When clicked, the page refreshes as if it's updated the total/applied the coupon/shipping value, but nothing happens.
Looking at the error logs, I see this:
PHP Notice: Undefined index: recurring in /home/[username]/public_html/catalog/view/theme/[custom_theme]/template/module/cart.tpl on line 19
These are lines 1-22 of cart.tpl:
<div id="cart">
<div class="heading">
<h4><?php echo $heading_title; ?></h4>
<a><span id="cart-total"><?php echo $text_items; ?></span></a></div>
<div class="content">
<?php if ($products || $vouchers) { ?>
<div class="mini-cart-info">
<table>
<?php foreach ($products as $product) { ?>
<tr>
<td class="image"><?php if ($product['thumb']) { ?>
<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" /></a>
<?php } ?></td>
<td class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
<div>
<?php foreach ($product['option'] as $option) { ?>
- <small><?php echo $option['name']; ?> <?php echo $option['value']; ?></small><br />
<?php } ?>
<?php if ($product['recurring']): ?>
- <small><?php echo $text_payment_profile ?> <?php echo $product['profile']; ?></small><br />
<?php endif; ?>
So I did some digging. It seems like the error isn't anything serious (PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"). I had a look at the top few solutions and I couldn't figure out how to properly alter the variable on line 19. I also had a look at this: How to correct PHP Notice: Undefined index but I'm not experienced enough with PHP to apply this solution to the code I'm dealing with.
I then migrated the entire site onto another server and domain and the cart page worked fine. The difference ended up being the SSL certificate - on the main site https is enabled on all pages, on the second server I don't have SSL installed.
EDIT: I then went back on my main server and disabled SSL in Opencart settings and disabled my htaccess https redirect. The cart then worked fine under http. But I'd like to have SSL enabled if possible.
I tried a stop-gap solution: forcing http on the cart page. I used this solution: mod_rewrite with exceptions to come up with this:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !/index.php?route=checkout/cart
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
But the site continues to force https on all pages, even when I type http:// in manually.
To summarize:
- Should I be working to fix the undefined PHP index, or should I just disable SSL on the cart page (the only page affected by SSL issues)?
- How can I best achieve the most appropriate solution in getting the cart page to function properly?