Jump to content

Can't veiw cart on product page


kurraglen
 Share

Recommended Posts

I have a couple of customers reported that when they go to a product page, the shopping cart won't show when clicked or hovered over. I tested it myself and when I go to the product page and add a product to the cart, the cart won't show unless I go to the main shop index page.

However, if the item is added from the main shop index page, the cart shows. The products are added to the cart but won't show on any of the individual product pages.

The site is: https://www.kurraglenindustries.com.au/shop/index.php

Cubecart version is: 6.4.4 using Noodleman V6 skin.

Thanks in advance, Bruce.

Link to comment
Share on other sites

This is what I have for Noodleman's V6 (version 1.0.2) skin:

template main.php:

<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" dir="{$TEXT_DIRECTION}" lang="{$HTML_LANG}">
    <head>
      <title>{$META_TITLE}</title>
      {include file='templates/element.meta.php'}
      <link href="{$CANONICAL}" rel="canonical">
      <link href="{$ROOT_PATH}/favicon.ico" rel="shortcut icon" type="image/x-icon">
      {include file='templates/element.css.php'}
      {include file='templates/content.recaptcha.head.php'}
      {include file='templates/element.google_analytics.php'}
      {include file='templates/element.js_head.php'}
   </head>

What I am not finding in the source HTML in my browser, from your site, when viewing a product, is the contents of element.js_head.php. So, either the {include} statement above is not there for viewing products, or the contents of of the js_head file is not itemizing the list of javascript files properly.

Link to comment
Share on other sites

I see this in the source HTML in my browser from the homepage:

<script src="https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit" async defer></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-5171864-1', 'auto');
ga('send', 'pageview');
</script><script type="text/javascript" src="/shop/cache/c40ca.js_head.noodleman_v6_20190831161300.js" charset="utf-8"></script></head>

This is what I get when viewing a product page:

<script src="https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit" async defer></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-5171864-1', 'auto');
ga('send', 'pageview');
</script></head>

What are the contents of element.js_head.php?

Please remind us of the exact version of PHP running your site.

PHP seems to be 7.1.33.

Link to comment
Share on other sites

All I can tell for the PHP version is in the cPanel it says version 7.1

The element.js_head.php contents are:

{assign var=js_head value=[ 'skins/{$SKIN_FOLDER}/js/vendor/modernizr.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.js']}
{foreach from=$HEAD_JS item=js}
    {$js_head[] = $js}
{/foreach}
{combine input=$js_head output='cache/js_head.{$SKIN_FOLDER}.js' age='604800' debug=false}

 

Link to comment
Share on other sites

As an experiment, please make the contents of that file contain only this code:

{assign var=js_head value=[ 'skins/{$SKIN_FOLDER}/js/vendor/modernizr.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.js']}
{combine input=$js_head output='cache/js_head.{$SKIN_FOLDER}.js' age='604800' debug=$CONFIG.debug||!$CONFIG.cache}
{foreach from=$HEAD_JS item=js}{$js}{/foreach}

The above is referencing the Github issue:

https://github.com/cubecart/v6/issues/2008

Please create the error log and see if there are any clues there:

https://forums.cubecart.com/topic/51550-how-to-create-the-error-log/

 

Edited by bsmither
Link to comment
Share on other sites

Thanks Brian, Changing the element.js_head.php to what you suggested has rectified the issue! I had a ini-custom.inc.php file in there already from a previous issue and the error log was huge. I downloaded and then removed the error log file and there is no new log file.  Question is, do I leave the element.js_head.php the way it is now, now that it is working or would that cause other issues?

On another note, you may remember the issue that I had with the review form not working, - 

well that also is now working as expected. Thanks, for your time and effort.

Bruce

Link to comment
Share on other sites

"do I leave the element.js_head.php the way it is now"

Please use this new version.

I would like to know what the latest error messages were, if any were related to a skin issue.

Are your store settings set such that CubeCart is running in debug mode?

Link to comment
Share on other sites

The error log file is huge (nearly 20 meg) but the latest few in it are:

</scrip in /home/kur49073/public_html/shop/includes/lib/smarty/plugins/function.combine.php on line 163
[13-Sep-2021 19:19:11 Australia/Sydney] PHP Warning:  File /home/kur49073/public_html/shop/<script src="https://www.paypal.com/sdk/js?client-id=AbbgN73WS7pChj6Os4nx-zJwvwrMwpFirXmxCvWy3M--ooCJZJ9owtS96z0IqDB-9fvgtAidMAzi2P71&currency=AUD&components=messages"></script>

<script>

    $(document).ready(function() {

        if ($("#ptp").length) {

            var amount = parseFloat($('#ptp').attr("data-price"));

            if($('.product_wrapper #main_content form .row .row').length) {

                $('<div class="pad-top" data-pp-placement="product" data-pp-message data-pp-amount="'+amount+'" data-pp-style-layout="text" data-pp-style-logo-type="inline" data-pp-style-logo-position="left" data-pp-style-text-color="black" data-pp-style-text-size="12"></div>').insertAfter(".product_wrapper #main_content form .row .row");

            } else {

                console.error("PayPal Message Error: DOM Element '.product_wrapper #main_content form .row .row' - Doesn't exist! Please check your PayPal Commerce settings.");

            }

        }

    });

</scrip in /home/kur49073/public_html/shop/includes/lib/smarty/plugins/function.combine.php on line 163

I can't see any that relates to a skin issue.

No I don't have debug turned on.

Link to comment
Share on other sites

This is what is happening:

The new Smarty command (as of CC640 or there-abouts) "combine" is expecting an array of filenames. As mentioned, the Github issue #2008 is expecting filenames in the template code found in element.js_head.php, but the $HEAD_JS array is getting loaded up with actual script code -- not filenames -- and appending real script code to the combine function. That's bad.

The new code in element.js_head.php does not add the $HEAD_JS elements to the Smarty $js_head array, but rather gets the real script code published to the template after the "combine" command where the filenames are combined.

 

Link to comment
Share on other sites

Hello,

my site https://www.volteq.com was working but we had to updatethe php version from 5.2 to 7.0. after that update, we have been having missing cart issue. when an item is added, the website does nothing, the cart is only visible if you click on another link.  

I checked out the main.php, and element.js_head.php, both seems to be the same as described above. just to be sure I copied and pasted the codes in this thread, the problem persists.

can someone help please?

Edited by sean1688
Link to comment
Share on other sites

When I click "Add to Basket" (on an item in Latest Products), the entire Shopping Basket box disappears. That is, CubeCart sends back nothing as a response, but a 200 OK status.

This tells me that either there is a logic flaw that PHP 7 cannot deal with (which would have been found and fixed by now), or a plugin that needs to be updated such that it is encoded to run under PHP 7.

The problem should be logged in the admin's System Error Log.

Edited by bsmither
Link to comment
Share on other sites

Thanks for a quick review. there is no error logged. I emptied the system error log and tried to add an item to the basket. still no error logged.

The item is actually added to the basket, as you can see the basket by clicking on any link. after that, the basket gamic ally appeared.

Link to comment
Share on other sites

Assuming you are running CubeCart6.4.X, enable debug mode (admin, Store Settings, Advanced tab, and also enter your local IP address in the adjacent field -- www.showmyip.com).

Click the Add to Basket on a product in the Latest Products section of the Homepage. The Basket box will disappear.

Now, revisit the Homepage. At the bottom of the page will be a grey section containing diagnostic data. There will be two parts: the first will have logged everything that happened during the AJAX call that was supposed to send back the new Basket Box HTML code, the second section will have logged everything that happened when you requested the Homepage afterwards.

Examine the first section (the AJAX call) for anything suspicious.

 

Link to comment
Share on other sites

this is what I get

PHP:
No Errors or Warnings


GET:

'_a' => NULL

SESSION:

'__client' =>
'ip_address' => '73.xx.xx.xx'
'useragent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'
'session_start' => 1631996916
'session_last' => 1631996920
'currency' => 'USD'
'admin_id' => '1'
'language' => 'en-US'
'__system' =>
'token' => 'fb8a55a35a53402fe9f5c204bb49aaed'
'__admin_data' =>
'admin_id' => '1'
'customer_id' => '0'
'status' => '1'
'name' => 'xxx'
'username' => 'xxx'
'new_password' => '1'
'email' => 'xxx'
'verify' => ''
'logins' => '4299'
'super_user' => '1'
'notes' => ''
'failLevel' => '0'
'blockTime' => '0'
'lastTime' => '1631996398'
'browser' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'
'ip_address' => '73.xx.xx.xx'
'language' => 'en-US'
'dashboard_notes' => ''
'order_notify' => '1'
'__admin' =>
'user_language' => 'en-US'
'version-check' => true
'__basket' =>
'contents' =>
'18cd1227b16132d65308308d174375e8' =>
'id' => 43
'quantity' => 1
'digital' => '0'
'option_line_price' => 0
'total_price_each' => '9.95'
'description' => ' For sale is a set of output leads / test leads that will work for the following variable switching DC power supply models:   1520EX 3010EX 3010E 3010EX-3 3010E-3 3020EX 3020E 5005-2 '
'name' => 'Output leads / test leads for Switching DC Power Supplies with output less than 900W'
'product_code' => 'leads#3'
'product_weight' => '0.200'
'tax_each' =>
'amount' => '0.00'
'tax_inclusive' => false
'tax_name' => NULL
'weight' => '0.200'
'discount' => '0.00'
'subtotal' => '9.95'
'total_tax' => '0.00'
'total' => '9.95'

from what I gathered, the only issue is that the action of "add-to-basket" somehow caused the shopping basket to disappear on the current page. the action, however, did do everything it supposed to do in the back-end, so that if you move away from the current page, you will see the basket with the correct content. My question is: can you interject something right after the action of "add-to-basket" to force the web page to update? even a simple reload of the page will solve the problem somehow.

Edited by sean1688
Link to comment
Share on other sites

Ok, so now we know the problem is with how this setting affects the AJAX response, in that a "Yes: Jump to basket on add" causes no response.

I note that you are using Kurouto -- which may explain something. The AJAX request is not including a "CSRF token", which CubeCart may be expecting/demanding, and if it isn't there, will not proceed to the View Basket page.

But then you say that this started happening when you upgraded to PHP 7.

Was this the only thing that changed? Could you possibly have also upgraded CubeCart very near the same time?

Link to comment
Share on other sites

For the Kurouto skin you are using, please examine the "config.xml" file. Tell us what version it is. There will be lines of info that look something like:

	<name><![CDATA[kurouto]]></name>
	<display><![CDATA[Kurouto]]></display>
	<version>1.0</version>

There could also be a line that indicates a "csrf" availability.

(But I do not see any substantive difference with Crosshatch.)

Link to comment
Share on other sites

this is what I found:

    <name><![CDATA[kurouto]]></name>
    <display><![CDATA[Kurouto]]></display>
    <version>1.0</version>
    <minVersion>5.0.0a</minVersion>
    <maxVersion>5.1.*</maxVersion>
    <creator>CubeCart Ltd</creator>
    <homepage>http://www.cubecart.com</homepage>
    <mobile>false</mobile>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...