X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   'Add to Cart' Alert Message (https://forum.x-cart.com/showthread.php?t=56998)

JWait 05-12-2011 02:30 PM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by bitofeverything
Works great. I added "return false" for the continue shopping link so the page does not refresh.


Can you be more specific? Thanks

JWait 05-17-2011 08:28 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by welly

I have now worked out that if you have featured products for a category (which in my case appear at the top of the page - not sure if this is standard), then the alert doesn't work. Actually, the alert box works if you add the featured product to your cart, but nothing in the standard product list will bring up the alert.

Remove the featured product(s), the alert works. Add a featured product to a different page, alerts on that page stop working.


I'm having the same problem. I wonder if adding something like "$main eq "featured" to the code "{if $main eq "product" || $main eq "search" || $main eq "products" || $main eq "catalog"}" would have any effect.

It seems to work fine on the product page, but there are problems in the "categories" and "featured products" areas.

Also, the links ("checkout", "continue shopping, etc.) at the bottom of the popup seem to need a little padding at the bottom, they are right against the bottom of the frame. Where would I adjust this?

Also, some else mentioned adding "return false" for the continue shopping link so the page does not refresh and go to the home page. Where and how would this be done?

Thanks!

UHS 05-23-2011 11:41 AM

Re: 'Add to Cart' Alert Message
 
Is this mod no longer available? The demo links no longer work for me. Anyone have any screenshots or demo I can take a look at?

JWait 05-23-2011 01:50 PM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by UHS
Is this mod no longer available? The demo links no longer work for me. Anyone have any screenshots or demo I can take a look at?

check post #12

JWait 05-23-2011 02:05 PM

Re: 'Add to Cart' Alert Message
 
1 Attachment(s)
OK.. I made some changes and now it works sweeeeet!

Added $main eq "featured" to the list of "pages" to fix the problem of it working sometimes and sometimes not, and modified the instructions. The attached file is for version 4.4.x (tested on 4.4.3).

welly 05-23-2011 03:48 PM

Re: 'Add to Cart' Alert Message
 
Hi JWait,

Having installed your version on (4.4.2) I find I still have the same problems as before.

The alert doesn't work on the manufacturers pages even if I add a test for $main eq "manufacturer_products" in the page list. The add to cart button just hangs on the 'added' label, even though the item is indeed added.

It also doesn't work on category pages where there is a featured item at the top of the page. It works fine for those featured products, but not on the category products themselves. I get the same hanging on the add to cart button, and no alert (except on the featured products at the top).

Do you have any thoughts on why this might be happening, or how to overcome it?

Changing the return from true to false is great. Thanks for clearing that up.

Cheers

Welly

JWait 05-24-2011 09:15 AM

Re: 'Add to Cart' Alert Message
 
I just did a test and "$main = catalog" everywhere except for the actual product page and on the manufacturer's page (where "$main = manufacturer_products" . I think the main problem is in the "if $main eq", like maybe it should be checking for something else instead of $main.... "if product is available" maybe. Its not my mod so I really don't know.

cflsystems 05-25-2011 03:03 AM

Re: 'Add to Cart' Alert Message
 
For the list of products pages not working - if you have same product listed as category product and featured product on the same page that may be the reason for the mod not working; it gets more then one reference to same product and doesn't know which one to use

JWait 05-25-2011 08:00 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by cflsystems
For the list of products pages not working - if you have same product listed as category product and featured product on the same page that may be the reason for the mod not working; it gets more then one reference to same product and doesn't know which one to use


It only seems to affect the pages that have both "featured" and "normal" products, regardless of whether the same product is there twice, at least as far as I can tell, I don't have any like that at the moment.

Strangely, I added the mod discussed here http://forum.x-cart.com/showthread.php?t=56298 and it works for those products as well, even though they are on the home page along with "featured" products, but it doesn't work with the "featured" products there. This leads me to believe there is something about the featured products that it doesn't like.

welly 06-02-2011 01:33 PM

Re: 'Add to Cart' Alert Message
 
I think I have figured out why the alert doesn't work on the manufacturer pages.

I assumed that adding the condition '$main eq "manufacturer_products"' to the list of conditions in the skin/common_files/customer/service_css.tpl file would be enough, but obviously it wasn't.

I've been looking at this again today, and it seems that similar conditions also exist in skin/common_files/modules/Cart_Alert/cart_alert.tpl, and therefore if you add the manufacturer_products condition to service_css.tpl then you must also add it to cart_alert.tpl. Otherwise, the add to cart process calls a function that never gets defined, which in turn stops the inventory from updating as it should.

There are 2 condition statements in cart_alert.tpl, and manufacturer_products needs to be added to the second one.

Alas, it doesn't help the problem with pages that have featured products at the top, but it is an improvement nonetheless.

Welly

welly 06-04-2011 04:40 PM

Re: 'Add to Cart' Alert Message
 
I haven't tested this exhaustively, but I think I have the alert working on category pages with featured products.

Step two of the installation suggests adding the following lines to service_head.tpl or service_css.tpl (depending on which iteration of the mod you install):

{if $main eq "product" || $main eq "search" || $main eq "products" || $main eq "catalog"}
<link href="{$SkinDir}/modules/Cart_Alert/css/shadowbox.css" type="text/css" rel="stylesheet">
<script src="{$SkinDir}/modules/Cart_Alert/shadowbox.js" type="text/javascript"></script>
{include file="modules/Cart_Alert/cart_alert.tpl"}
{/if}

(note that in the above, the extra condition I've added for the manufacturer list is missing as it is a cut-n-paste from the installation txt file only).

I have added these lines to the top of the skin/common_files/customer/main/products_list.tpl file, and in the service_head.tpl file I have changed the first line of the above snippet to read:

{if $main eq "product"}

It seems to work on the store I'm building at the moment, but please take the usual precautions if you try it on yours just in case I've broken something without knowing (yet).

Welly

floracal 06-15-2011 08:11 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by JWait
OK.. I made some changes and now it works sweeeeet!

Added $main eq "featured" to the list of "pages" to fix the problem of it working sometimes and sometimes not, and modified the instructions. The attached file is for version 4.4.x (tested on 4.4.3).


Works great JWait great job. Works great on 4.4.3.

Thank you.

a1deano 07-01-2011 11:42 AM

Re: 'Add to Cart' Alert Message
 
Just wondered if there is anyway way to make the pop up just stay on for a few seconds and then disappear just to show customer item was added to cart

graffix 09-01-2011 10:46 AM

Re: 'Add to Cart' Alert Message
 
Man, I have this mod working, but it WILL NOT display my upsell products for anything... It always displays the next three products in line after the one I choose. Any suggestions anyone?
EDIT**
Actually, its always displaying the first three products from that category, really odd. I have entered products into related products inside the admin panel...this is really starting to get to me.

swartzieee 04-30-2012 04:45 PM

Re: 'Add to Cart' Alert Message
 
I just downloaded this and attempted to install. I am running the Ability Template from xcartmods.co.uk. I do not get a popup at all. Any suggestions?

bitofeverything 04-30-2012 05:09 PM

Re: 'Add to Cart' Alert Message
 
check for any javascript errors in firefox/firebug

swartzieee 04-30-2012 05:13 PM

Re: 'Add to Cart' Alert Message
 
I do not see any errors??

Duramax 6.6L 04-30-2012 05:35 PM

Re: 'Add to Cart' Alert Message
 
If you are using ability, make sure any files that need to be changed are also change in the ability folder

swartzieee 04-30-2012 05:38 PM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by Duramax 6.6L
If you are using ability, make sure any files that need to be changed are also change in the ability folder


I think that is my problem. I am not sure of all what files need to be edited. Guess I need to wait for Phil to respond or someone who has this mod working on Ability. What files of your Smart Template did you have to edit? I am sure Smart and Ability are pretty close.

bitofeverything 04-30-2012 06:27 PM

Re: 'Add to Cart' Alert Message
 
you have unterminated string literal js errors being generated.

swartzieee 05-01-2012 09:27 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by bitofeverything
you have unterminated string literal js errors being generated.


Thanks for pointing this out. I am just not sure of how to get this mod to work with the Ability Template.

bitofeverything 05-01-2012 09:38 AM

Re: 'Add to Cart' Alert Message
 
It shouldn't have anything todo with the template.
It generally happens when your products have 's in the name.
try replacing your cart_alert.tpl with the following (strips out any ' from the product for the alert)


{if $main eq "product"}

{literal}
<script type="text/javascript">
function Cart_Alert_Product_{/literal}{$product.productid}{literal}() {
Shadowbox.open({player:"html",content:'<div class="alert_msg"><div class="links"><a href="cart.php"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart.png" />{/literal}{$lng.lbl_cart_alert_view}{literal}</a></div><div class="links"><a href="{/literal}{$stored_navigation_script}{literal}" onclick="Shadowbox.close();return false"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart_put.png" />{/literal}{$lng.lbl_cart_alert_continue}{literal}</a></div><div class="links"><a href="cart.php?mode=checkout"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart_go.png" />{/literal}{$lng.lbl_cart_alert_checkout}{literal}</a></div><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/tick.png" />{/literal}{$lng.lbl_cart_alert_added}{literal}<h2>{/literal}{$product.product|replace:'\'':''}{literal }</h2><p>{/literal}<a href="#" onclick="Shadowbox.close();">{include file="product_thumbnail.tpl" productid=$product.image_id image_y=125 product=$product.product|escape tmbn_url=$product.image_url id="product_thumbnail" type=$product.image_type}</a>{literal}</p><p>{/literal}{$lng.lbl_cart_alert_to_cart}{literal}</p><hr /><h3>{/literal}{$lng.lbl_cart_alert_also}{literal}</h3>{/literal}{if $product_links}{section name=product loop=$product_links max=3}<div class="upsell"><a href="product.php?productid={$product_links[product].productid}">{include file="product_thumbnail.tpl" productid=$product_links[product].productid product=$product_links[product].product tmbn_url=$product_links[product].tmbn_url image_y=75}</a><br />{$product_links[product].product|escape:"html"}</div>{/section}{else}{section name=product loop=$recommends max=3}<div class="upsell"><a href="product.php?productid={$recommends[product].productid}">{include file="product_thumbnail.tpl" productid=$recommends[product].productid product=$recommends[product].product tmbn_url=$recommends[product].tmbn_url image_y=75}</a><br />{$recommends[product].product|escape:"html"}</div>{/section}{/if}{literal}<div class="clearing"></div>',height:420,width:600});}
Shadowbox.init();
</script>
{/literal}

{elseif $main eq "search" || $main eq "products" || $main eq "catalog"}

{foreach from=$products item=product name=products}
{literal}
<script type="text/javascript">
function Cart_Alert_Product_{/literal}{$product.productid}{literal}() {
Shadowbox.open({player:"html",content:'<div class="alert_msg"><div class="links"><a href="cart.php"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart.png" />{/literal}{$lng.lbl_cart_alert_view}{literal}</a></div><div class="links"><a href="{/literal}{$stored_navigation_script}{literal}" onclick="Shadowbox.close();return false"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart_put.png" />{/literal}{$lng.lbl_cart_alert_continue}{literal}</a></div><div class="links"><a href="cart.php?mode=checkout"><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/cart_go.png" />{/literal}{$lng.lbl_cart_alert_checkout}{literal}</a></div><img class="icon" src="{/literal}{$SkinDir}{literal}/modules/Cart_Alert/images/tick.png" />{/literal}{$lng.lbl_cart_alert_added}{literal}<h2>{/literal}{$product.product|replace:'\'':''}{literal }</h2><p>{/literal}<a href="#" onclick="Shadowbox.close();"><img src="image.php?id={$product.productid}&type=T" /></a>{literal}</p><p>{/literal}{$lng.lbl_cart_alert_to_cart}{literal}</p><hr /><h3>{/literal}{$lng.lbl_cart_alert_also}{literal}</h3>{/literal}{section name=product loop=$products max=3}<div class="upsell"><a href="product.php?productid={$products[product].productid}">{include file="product_thumbnail.tpl" productid=$products[product].productid product=$products[product].product tmbn_url=$products[product].tmbn_url image_y=75}</a><br />{$products[product].product|escape:"html"}</div>{/section}{literal}<div class="clearing"></div></div>',height:420,width:600});}
Shadowbox.init();
</script>
{/literal}
{/foreach}

{/if}

swartzieee 05-01-2012 09:42 AM

Re: 'Add to Cart' Alert Message
 
The change has been made but still does not work.

bitofeverything 05-01-2012 09:56 AM

Re: 'Add to Cart' Alert Message
 
I'm still seeing the js errors - have you cleared your website's cache?
Also, make sure that the javascript code is on one line (line wrap is fine, but new lines will break it)

swartzieee 05-01-2012 10:08 AM

Re: 'Add to Cart' Alert Message
 
Here is the javascript code

// Widget :: change state to Added
ajax.widgets.add2cart.obj.prototype.doAddedState = function() {
this.button.addClass('do-add2cart-success');

this._freezeBox();

if (this.savedData.box)
this.savedData.box.html(lbl_added);

// Added to Cart Alert Start
window['Cart_Alert_Product_' + this.productid]();
// Added to Cart Alert End

return true;
}

bitofeverything 05-01-2012 10:19 AM

Re: 'Add to Cart' Alert Message
 
1 Attachment(s)
The js errors have todo with the 'content' part of the Shadowbox.open()

swartzieee 05-01-2012 10:22 AM

Re: 'Add to Cart' Alert Message
 
This mod has me stumped. Phil or Steve.. You out there?

cflsystems 05-01-2012 10:22 AM

Re: 'Add to Cart' Alert Message
 
If you have ' or " or ; or & in product names, descriptions or images alt text this will break the code unless you escape them

swartzieee 05-01-2012 10:26 AM

Re: 'Add to Cart' Alert Message
 
I do not believe I have ' or " or ; or & in product names, descriptions or images alt text but to be safe how do I find out and how do I escape them?

bitofeverything 05-01-2012 10:31 AM

Re: 'Add to Cart' Alert Message
 
The js code above (#62) that starts with Shadowbox.open needs to be on one line.
The newline char is breaking the string (starts with ')

cflsystems 05-01-2012 10:33 AM

Re: 'Add to Cart' Alert Message
 
Seems like the code is escaped but can't tell you much without seeing it in action. You use "|escape" to escape special characters, you can use "|escape:'alt'" or "|escape:'html'"

swartzieee 05-01-2012 10:39 AM

Re: 'Add to Cart' Alert Message
 
Steve, I can give you ftp access if you would like?

bitofeverything 05-01-2012 10:42 AM

Re: 'Add to Cart' Alert Message
 
3 Attachment(s)
somehow the js code is getting broken up on multiple lines.
I'm attaching screenshots of working code, the working source code and the source code from buckeye.

swartzieee 05-01-2012 11:04 AM

Re: 'Add to Cart' Alert Message
 
bitofeverything - Thank you for all your help. I am not sure how to fix this issue though.

bitofeverything 05-01-2012 12:04 PM

Re: 'Add to Cart' Alert Message
 
something is placing the javascript code across multiple lines.
The code in the cart_alert.tpl should look like the 1st screenshot.
If your code looks like that, then look at the product_thumbnail.tpl as the newline braeks are happening directly after the image tag

swartzieee 05-01-2012 02:11 PM

Re: 'Add to Cart' Alert Message
 
I do not see where it has line breaks in my code.

bitofeverything 05-01-2012 02:57 PM

Re: 'Add to Cart' Alert Message
 
1 Attachment(s)
I've attached a copy of the cart_alert.tpl that I use.
The only other thing that I can suggest is taking the code apart piece by piece.

cflsystems 05-01-2012 02:57 PM

Re: 'Add to Cart' Alert Message
 
Which site is this for? Is the code on the site?

swartzieee 05-01-2012 03:09 PM

Re: 'Add to Cart' Alert Message
 
The site is http://www.BuckeyeFanApparel.com

The code is currently active. I could grant you access to ftp if you would like Steve.

cflsystems 05-01-2012 03:25 PM

Re: 'Add to Cart' Alert Message
 
Yes you have line breaks in the code which will break the js script. Everything between

Shadowbox.open(

and

',height:420,width:600});}

has to be one line, you can have empty space between tags but no line breaks


All times are GMT -8. The time now is 11:37 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.