If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / AJAX Add to Cart [Support Thread]

AJAX Add to Cart [Support Thread]

Started by balihr on 6 Jun 2014, 1:13 PM · Views: 29,036

Results 61 to 80 of 134
13 Oct 2014, 5:14 PM
#61
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #61 by balihr

Absolutely! :)

Since you're a new Zenner, please remember that Zen Cart is a community driven platform and members are here to help each other. Any questions you have about ANY plugins, please post it in the public forums so that everyone else can benefit from potential answers... Oh, and - welcome to Zen Cart! :)

You WILL need to run the SQL patch, but it's slightly different for the 1.3.x series. The only difference is that you don't need to register Admin Pages. So, the SQL patch for versions older than 1.5.0 would be:

SELECT @ZXconfig:=configuration_group_id
FROM configuration_group
WHERE configuration_group_title= 'ZX AJAX Cart'
LIMIT 1;
DELETE FROM configuration WHERE configuration_group_id = @ZXconfig AND configuration_group_id != 0;
DELETE FROM configuration_group WHERE configuration_group_id = @ZXconfig AND configuration_group_id != 0;
INSERT INTO configuration_group (configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible) VALUES (NULL, 'ZX AJAX Cart', 'ZX AJAX Add to Cart', '1', '1');
SET @ZXconfig=last_insert_id();
UPDATE configuration_group SET sort_order = @ZXconfig WHERE configuration_group_id = @ZXconfig;
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES 
(NULL, 'ZX AJAX Cart', 'ZX_AJAX_CART_STATUS', 'false', 'Activate ZX AJAX Add to Cart', @ZXconfig, 10, NOW(), NULL, 'zen_cfg_select_option(array(\'true\', \'false\'),'),
(NULL, 'Use jQuery', 'ZX_AJAX_CART_JQUERY', 'false', 'If your template is already utilizing jQuery, keep this disabled. If you\'re not loading jQuery, please set to true.', @ZXconfig, 20, NOW(), NULL, 'zen_cfg_select_option(array(\'false\', \'true\'),'),
(NULL, 'Show Close Cart button', 'ZX_AJAX_CART_CLOSE_BUTTON', 'false', 'Do you want to show the Close Cart button in the slider?', @ZXconfig, 25, NOW(), NULL, 'zen_cfg_select_option(array(\'false\', \'true\'),'),
(NULL, ' Effect', 'ZX_AJAX_CART_FADE_DELAY', '6000', 'How long is the popup shown before it fades out (in miliseconds)', @ZXconfig, 30, NOW(), NULL, NULL),
(NULL, 'ZX AJAX Add to Cart Version', 'ZX_AJAX_CART_VERSION', '1.1', 'Currently using: <strong>v1.1</strong><br />Module brought to you by <a href="http://www.zenexpert.com" target="_blank">ZenExpert</a>', @ZXconfig, 50, NOW(), NULL, 'zen_cfg_select_option(array(\'1.1\'),');

My site - Pro ZC Help
My portfolio | My plugins

14 Oct 2014, 12:38 PM
#62
khejit avatar

khejit

New Zenner

Join Date:
Aug 2014
Location:
Polska
Posts:
20
Plugin Contributions:
0

Post #62 by khejit

When I tried to install sql patch there were some errors:

Success 11 statements processed.
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Warning Note: 1 statements ignored. See "upgrade_exceptions" table for additional details.

And when I choose Configuration-> ZX Ajax Add To Cart, there is nothing except headings "Title" "Value" "Action". I have zc 1.5.1
What am I doing wrong?:dontgetit

14 Oct 2014, 4:53 PM
#63
noahmarket avatar

noahmarket

New Zenner

Join Date:
Oct 2014
Location:
North Carolina
Posts:
8
Plugin Contributions:
1

Post #63 by noahmarket

Can you tell me how to update my cart that is displayed on the page top right when the ajax cart updates ?
I am using the stirling grand template.
And when i add to cart, the ajax updates but the top cart display does not is there a way to make it ?
Thank you for the mod !!

14 Oct 2014, 5:02 PM
#64
noahmarket avatar

noahmarket

New Zenner

Join Date:
Oct 2014
Location:
North Carolina
Posts:
8
Plugin Contributions:
1

Post #64 by noahmarket

noahmarket:

Can you tell me how to update my cart that is displayed on the page top right when the ajax cart updates ?
I am using the stirling grand template.
And when i add to cart, the ajax updates but the top cart display does not is there a way to make it ?
Thank you for the mod !!

Here is template im running zen 1.5.3
http://www.picaflor-azul.com/responsive-stirling-grand-free-zen-cart-template

14 Oct 2014, 10:03 PM
#65
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #65 by balihr

khejit:

When I tried to install sql patch there were some errors:

Success 11 statements processed.
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Error ERROR: Cannot insert configuration_key "" because it already exists
Warning Note: 1 statements ignored. See "upgrade_exceptions" table for additional details.

And when I choose Configuration-> ZX Ajax Add To Cart, there is nothing except headings "Title" "Value" "Action". I have zc 1.5.1
What am I doing wrong?:dontgetit

Hm... Restore your database backup and try again. There's also a chance that you won't be able to run the SQL patch, usually because of some host related issues which I have never been able to figure out. If that's the case, you'll need to insert all the values manually from phpMyAdmin.

My site - Pro ZC Help
My portfolio | My plugins

14 Oct 2014, 10:07 PM
#66
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #66 by balihr

noahmarket:

Can you tell me how to update my cart that is displayed on the page top right when the ajax cart updates ?
I am using the stirling grand template.
And when i add to cart, the ajax updates but the top cart display does not is there a way to make it ?
Thank you for the mod !!

I would need to see your site - most likely you didn't install the plugin correctly. You would need to disable any template related shopping cart header icons and use the one that comes with this mod, otherwise the script won't update your locations. Of course, you can make custom changes to the mod and make it work with your selectors and targets, but that's a different story and I can't support that here.

P.S. Please don't enlarge the font - standard size is good enough. :wink:

My site - Pro ZC Help
My portfolio | My plugins

15 Oct 2014, 2:26 PM
#67
khejit avatar

khejit

New Zenner

Join Date:
Aug 2014
Location:
Polska
Posts:
20
Plugin Contributions:
0

Post #67 by khejit

balihr:

Hm... Restore your database backup and try again. There's also a chance that you won't be able to run the SQL patch, usually because of some host related issues which I have never been able to figure out. If that's the case, you'll need to insert all the values manually from phpMyAdmin.
Thank you, this worked! I had to change sql command adding my database prefix _ewa before names of main tables to modify. If someone has similiar problem it can be caused by database prefix ;)

I have one more question: how to add this on listing pages?

15 Oct 2014, 5:15 PM
#68
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #68 by balihr

Hm, this is interesting... If the SQL patch is run from the admin, the prefix doesn't need to be added... Weird...

As for listing pages - it's currently not supported and is awaiting for me to get some free time and add the feature. It's been on the to-do list since day one, but I just didn't get to it yet.

My site - Pro ZC Help
My portfolio | My plugins

15 Oct 2014, 9:57 PM
#69
khejit avatar

khejit

New Zenner

Join Date:
Aug 2014
Location:
Polska
Posts:
20
Plugin Contributions:
0

Post #69 by khejit

One more little thing ;) I want to replace "Your Cart" (TEXT_AJAX_CART_TITLE) with image of cart that I already have.
Could this be replaced with image easily?

15 Oct 2014, 10:02 PM
#70
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #70 by balihr

Sure - just edit the define text (includes/languages/english/extra_definitions/zx_ajax_cart.php) and make it something like:

define('TEXT_AJAX_CART_TITLE', '<img src="images/icons/cart.png" alt="Your Cart" />');

Of course, enter the correct path to your image...

My site - Pro ZC Help
My portfolio | My plugins

17 Oct 2014, 12:00 AM
#71
noahmarket avatar

noahmarket

New Zenner

Join Date:
Oct 2014
Location:
North Carolina
Posts:
8
Plugin Contributions:
1

Post #71 by noahmarket

noahmarket:

The only issue i have now is when i shrink it like im viewing from phone i cannot get into the shopping cart so i still got more work to do

Thanks !!

balihr:

Yeah, I just checked and I can see what you mean, but that's because of your styling and absolute positioning. If you add additional lines for cart popup placeholder in the responsive breakpoints, I'm sure you'll have it visible.

noahmarket:

Yea tried that but still no luck getting it to popup

put this in responsive css but it affects the regular template also

#carttopcontainer {
float:none;width:276px;border:3px solid #ccoo33;margin:0;padding:10;padding-bottom:20px;}


> **balihr:**
>
> Are you sure you put it in the correct place? It should be after a device width breakpoint, something like:
> ```
@media (max-width: 479px) {

That way it's an override for mobile devices and should work.

balihr and I Were talking about responsive issues with a template and shopping cart

19 Jan 2015, 10:52 AM
#72
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Post #72 by divavocals

Okay.. So I've got this installed.. I added an Awesome Font cart glyph in front of the header cart totals this mods generates. I even got the header totals to appear in place of the normal header cart totals so that if I turn this module off, the default header totals/icons appear..

Here's what I am having issues with...

The formatting of the header totals.. Specifically I cannot seem to figure out what I need to do to get the totals to appear WHERE they should in the header.. Currently, they sit to the left of my header links.. I am using the Westminster-New template.

Here's all the changes I made:
includes/templates/MY_TEMPLATE/common/tpl_header.php

    <li>
<!-- BOF ZX AJAX Add to Cart -->
<?php
// BOF AJAX Cart 
    if (ZX_AJAX_CART_STATUS == 'true') {
        echo '<div id="carttopcontainer"></div>';
        require(DIR_WS_MODULES. 'sideboxes/'.$template_dir. '/zx_ajax_shopping_cart.php');
    } else {  
    echo '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') .'"><i class="fa fa-shopping-cart"></i> '. $_SESSION['cart']->count_contents() .' - '. $currencies->format($_SESSION['cart']->show_total()) .'</a> | ';
   } 
// EOF AJAX Cart
?>
<!-- EOF ZX AJAX Add to Cart -->
</li>

includes/templates/YOUR_TEMPLATE/sideboxes/tpl_zx_ajax_shopping_cart.php

    $content .= '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') .'" onClick="ajax_cart(); return false"><i class="fa fa-shopping-cart"></i> '. $_SESSION['cart']->count_contents() .' - '. $currencies->format($_SESSION['cart']->show_total()) .'</a></div> | ';

add_prod.php

    $cart_top = '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') .'" onClick="ajax_cart(); return false"><i class="fa fa-shopping-cart"></i> '. $_SESSION['cart']->count_contents() .' - '. $currencies->format($_SESSION['cart']->show_total()) .'</a>';    

add_to_cart.php

    $content .= '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') .'" onClick="ajax_cart(); return false"><i class="fa fa-shopping-cart"></i> '. $_SESSION['cart']->count_contents() .' - '. $currencies->format($_SESSION['cart']->show_total()) .'</a>';

Finally link to dev site: http://clientscrappin(dot)divawebdzgn(dot)com/arts-and-entertainment-c-458/dance-c-458_16/best-creation-ballet-princess-ballet-love-tags-glitter-paper-p-13207.html

What do I need to modify to get the cart totals to site between the "Login" and "Checkout" links??

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

19 Jan 2015, 10:59 AM
#73
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #73 by balihr

It has position:absolute so you need to edit stylesheet_ajax_cart.css at line 4. Change left:0 to right:10%
If that's what you're asking :)

My site - Pro ZC Help
My portfolio | My plugins

19 Jan 2015, 11:36 AM
#74
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Post #74 by divavocals

balihr:

It has position:absolute so you need to edit stylesheet_ajax_cart.css at line 4. Change left:0 to right:10%
If that's what you're asking :)

That moves over the popup.. but I was actually asking about the links in the top header bar.. If you look at the site, you'll see that the cart totals appear to the left of the "Login" link.. I want them between the pipes "|"

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

19 Jan 2015, 11:41 AM
#75
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #75 by balihr

Hehe, and where is it that it should appear? :) All the way to the left, basically above the popup? I'm confused, not sure what exactly you're trying to do. Give this blind man a hint with some photoshop...

My site - Pro ZC Help
My portfolio | My plugins

19 Jan 2015, 11:46 AM
#76
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Post #76 by divavocals

balihr:

Hehe, and where is it that it should appear? :) All the way to the left, basically above the popup? I'm confused, not sure what exactly you're trying to do. Give this blind man a hint with some photoshop...

If you visit the dev site: http://clientscrappin(dot)divawebdzgn(dot)com/arts-and-entertainment-c-458/dance-c-458_16/best-creation-ballet-princess-ballet-love-tags-glitter-paper-p-13207.html

Look in the upper right hand side of the site..

You will see the cart totals (which come from this mod), the "Login" link, and the "Checkout link..

See the pipes "|" character between the "Login" link, and the "Checkout links?? The cart totals should go THERE..

I attached a screenprint.. but if you go to the dev site you can see this there too..

Attachment 14879

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

19 Jan 2015, 12:00 PM
#77
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,819
Plugin Contributions:
24

Post #77 by balihr

Ah! Why didn't you say so in the first place? :p

Here's an idea, although I haven't tested. I would go for the templates tpl_header.php and insert a new <li> on line 70 (don't forget to close and re-open the if($_SESSION['customer_id']). Make that <li id=" carttopcontainer"> instead of adding that div with the same id. I think it should do the trick...

My site - Pro ZC Help
My portfolio | My plugins

19 Jan 2015, 4:09 PM
#78
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Post #78 by divavocals

balihr:

Ah! Why didn't you say so in the first place? :pWelll not for nothing I kinda did..:blush:

balihr:

Here's an idea, although I haven't tested. I would go for the templates tpl_header.php and insert a new <li> on line 70 (don't forget to close and re-open the if($_SESSION['customer_id']). Make that <li id=" carttopcontainer"> instead of adding that div with the same id. I think it should do the trick...
Okay.. well this didn't change the position of the cart totals.. they still sit to the left of the rest of the header links.. BUT this was a better way to code this conditional statement.. Here's what my templates tpl_header.php code looks like now:

<?php //if ($_SESSION['cart']->count_contents() != 0) { ?>
<!-- BOF ZX AJAX Add to Cart -->
<?php
// BOF AJAX Cart 
    if (ZX_AJAX_CART_STATUS == 'true') {
        echo '<li id=" carttopcontainer">';
        require(DIR_WS_MODULES. 'sideboxes/'.$template_dir. '/zx_ajax_shopping_cart.php');
    } else {  
    echo '<li>';
    echo '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') .'"><i class="fa fa-shopping-cart"></i> '. $_SESSION['cart']->count_contents() .' - '. $currencies->format($_SESSION['cart']->show_total()) .'</a> | ';
   } 
// EOF AJAX Cart
?>
<!-- EOF ZX AJAX Add to Cart -->
</li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php //}?>

Please note that the first line:

<?php //if ($_SESSION['cart']->count_contents() != 0) { ?>

and last line:

<?php //}?>

includes double slashes (//). This means the cart totals will show regardless as to whether the cart is empty or not.

I'm pretty sure that this is a CSS change at this point.. I cannot figure out the right CSS changes needed to get this part of the menu to sit where I need it to..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

20 Jan 2015, 1:42 PM
#79
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Post #79 by divavocals

balihr:

Ah! Why didn't you say so in the first place? :p

Here's an idea, although I haven't tested. I would go for the templates tpl_header.php and insert a new <li> on line 70 (don't forget to close and re-open the if($_SESSION['customer_id']). Make that <li id=" carttopcontainer"> instead of adding that div with the same id. I think it should do the trick...

FYI.. I rolled back my includes/templates/MY_TEMPLATE/common/tpl_header.php mods to what I originally posted..

    <li>
<!-- BOF ZX AJAX Add to Cart -->
<?php
// BOF AJAX Cart 
    if (ZX_AJAX_CART_STATUS == 'true') {
        echo '<div id="carttopcontainer"></div>';
        require(DIR_WS_MODULES. 'sideboxes/'.$template_dir. '/zx_ajax_shopping_cart.php');
    } else {  
    echo '<a href="'. zen_href_link(FILENAME_SHOPPING_CART, '',  'NONSSL') .'"><i class="fa fa-shopping-cart"></i> '.  $_SESSION['cart']->count_contents() .' - '.  $currencies->format($_SESSION['cart']->show_total())  .'</a> | ';
   } 
// EOF AJAX Cart
?>
<!-- EOF ZX AJAX Add to Cart -->
</li>

Turns out that the ID "carttopcontainer" needs to be in it's own div container for the menu popup to work correctly..

I am noticing that there are some anomalies with how this menu behaves when it comes to out of stock products.. Discovered this when testing the mobile views since I turn off the menu on mobile devices.. I need to do more testing and will report back my findings in full.. It appears to not be firing off some of the messages that I would see in the default cart behavior..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

20 Feb 2015, 1:15 PM
#80
kitten091182 avatar

kitten091182

Zen Follower

Join Date:
May 2007
Posts:
110
Plugin Contributions:
0

Post #80 by kitten091182

Hi Diva,
I'm using this mod on a test site with the Westminster new template, and it seems to be working fine in normal, mobile and tablet view, if you wanted to see the file changes I made I can post them?
What problems were you having with it though, as I'm worried there may be other problems I have overlooked and I don't want to put it on my live site until I'm sure.

Thanks