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)

nickff 12-10-2010 01:08 PM

'Add to Cart' Alert Message
 
Hi All,

I'm wanting to add one of those "information" alert boxes (you know, the ones styled up in main.css using the "message-i" class). I'm not re-directing people to the cart upon adding to cart, so I want them to know for sure they've successfully added something to their cart, and one of these handy info boxes on page refresh would be perfect.

Does anyone know how to go about firing one of those boxes off upon page refresh, post-add to cart?

Let me know if you have any ideas. Thanks all!

PhilJ 12-11-2010 04:56 AM

Re: 'Add to Cart' Alert Message
 
I've had a go at a mod... demo
It displays upselling products, or random products if no upselling.
Getting it to work on the products or search result pages is a bit more complex.
I can upload the mod as-is here, and maybe others can expand on it.

* Updated *

Duramax 6.6L 12-11-2010 05:48 AM

Re: 'Add to Cart' Alert Message
 
Phil,

If you get this working 100% I would be interested in the mod. I would even be willing to pay a small fee.

cflsystems 12-11-2010 06:16 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by PhilJ
I can upload the mod as-is here, and maybe others can expand on it.


If you upload it here that would be great Phil, thanks. The demo looks very promising

PhilJ 12-11-2010 10:33 AM

Re: 'Add to Cart' Alert Message
 
Quote:

If you upload it here that would be great Phil, thanks. The demo looks very promising
Here you go - If anyone can improve it, please share here :)

Duramax 6.6L 12-11-2010 01:56 PM

Re: 'Add to Cart' Alert Message
 
Thank you very much, Phil

nickff 12-11-2010 09:08 PM

Re: 'Add to Cart' Alert Message
 
This looks fantastic Phil, thank-you so much. I'll give a go at implementing it next week and let you know how it goes.

Thanks again!

nickff 12-14-2010 05:28 AM

Re: 'Add to Cart' Alert Message
 
**NEVERMIND**

I had edited my buy now button and that's what broke it.

**/NEVERMIND**

Quick question- For the Ajax add to cart functionality to be in place, I just need to check "Update mini-cart in background on product list and product details pages" in general settings, right? I'm struggling just to get the ajax add to cart to work, and wanting to make sure I'm not missing something in the admin.

Let me know, thanks!

cflsystems 12-15-2010 07:22 PM

Re: 'Add to Cart' Alert Message
 
1 Attachment(s)
Ok here is an improvement for 4.4.x (it may work on 4.3.x as well but not tested). Made it to work on categories list pages, read the install.txt

bitofeverything 01-24-2011 10:57 AM

Re: 'Add to Cart' Alert Message
 
Works great. I added "return false" for the continue shopping link so the page does not refresh.

xtech 02-08-2011 06:17 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by PhilJ
Here you go - If anyone can improve it, please share here :)


Is it possible for 4.1.x version also?

PhilJ 02-08-2011 10:46 AM

Re: 'Add to Cart' Alert Message
 
Quote:

Is it possible for 4.1.x version also?
This is for v4.3.x and v4.4.x only I'm afraid.

I have updated the install files, which you can get here

Thanks to Steve :)

graffix 02-28-2011 12:23 PM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by nickff
**NEVERMIND**

I had edited my buy now button and that's what broke it.

**/NEVERMIND**

Quick question- For the Ajax add to cart functionality to be in place, I just need to check "Update mini-cart in background on product list and product details pages" in general settings, right? I'm struggling just to get the ajax add to cart to work, and wanting to make sure I'm not missing something in the admin.

Let me know, thanks!


What is the default value of the Buy Now button that you refer to. I have edited mine as well, and I believe that is why I can't get this mod working. Is it originally just "Add To Cart"? Also, could I change this value elsewhere to make it work with my buy it now button?

PhilJ 03-06-2011 08:10 AM

Re: 'Add to Cart' Alert Message
 
6th March 2011 - The mod has been updated to display upselling items properly on the search results pages and it now has proper language labels :) Here

graffix 03-06-2011 03:27 PM

Re: 'Add to Cart' Alert Message
 
I followed all the instructions, but when I add an item to the cart firebug trips on this error:

window["Cart_Alert_Product_" + this.productid] is not a function

Line 383

graffix 03-07-2011 12:49 AM

Re: 'Add to Cart' Alert Message
 
I think I may have an idea as to what is going on. It looks like cart_alert.tpl isn't getting loaded. I have a feeling this is because I have xcart installed in a subdirectory. How can I change the include to make it call my subdirectory?

graffix 03-07-2011 09:16 AM

Re: 'Add to Cart' Alert Message
 
Man I just don't get it, I'm not dumb and I followed the instructions to a Tee. Either the instructions are not written correctly, or they are just plain wrong. For some reason the include isn't happening, anyone who could help me with this it would be greatly appreciated.

PhilJ 03-07-2011 09:52 AM

Re: 'Add to Cart' Alert Message
 
Having the store in a subdir should not affect the mod in anyway.

Try running cleanup.php afterwards.

If you are using an alternative skin, check that you have added the code in step 3 to the correct file.

graffix 03-07-2011 10:04 AM

Re: 'Add to Cart' Alert Message
 
I followed all the instructions, patched the DB with the included SQL queries, added all the code, switched back to the default skin just to make sure, even though the skin i'm using still uses service_head.tpl. Here is what my service_head.tpl looks like

{*
$Id: service_head.tpl,v 1.1 2010/05/21 08:32:02 joy Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{get_title page_type=$meta_page_type page_id=$meta_page_id}
{include file="customer/meta.tpl"}
{include file="customer/service_js.tpl"}
{include file="customer/service_css.tpl"}
{if $canonical_url}
<link rel="canonical" href="{$current_location}/{$canonical_url}" />
{/if}
{if $config.SEO.clean_urls_enabled eq "Y"}
<base href="{$catalogs.customer}/" />
{/if}
{if $main eq "product" || $main eq "search" || $main eq "products" || $main eq "catalog"}
<link type="text/css" rel="stylesheet" href="{$SkinDir}/modules/Cart_Alert/css/shadowbox.css" />
<script type="text/javascript" src="{$SkinDir}/modules/Cart_Alert/shadowbox.js"></script>
{include file="modules/Cart_Alert/cart_alert.tpl"}
{/if}
{load_defer_code type="css"}
{load_defer_code type="js"}


and again the debugger error I get in firebug is:

window["Cart_Alert_Product_" + this.productid] is not a function

Line 383

I hope I don't seem like a complete idiot, I am new to xcart and smarty, but the instructions are PAINFULLY simple and I have followed them, any ideas?

PhilJ 03-07-2011 10:04 AM

Re: 'Add to Cart' Alert Message
 
Add the code after..

{load_defer_code type="css"}
{load_defer_code type="js"}

graffix 03-07-2011 10:14 AM

Re: 'Add to Cart' Alert Message
 
Yeah I just did that again to be sure, same error in firebug. It's like cart_alert.tpl is never being included... I have tried every skin that is in the default installation. The one I see on the demo site is light and lucid, this is the right skin correct? I have added the code to head.tpl instead of service_head.tpl, tried all types of different code placements and I jsut can't get this working.

cflsystems 03-07-2011 10:15 AM

Re: 'Add to Cart' Alert Message
 
And make sure you are modifying the correct file for the skin you are using

graffix 03-07-2011 10:30 AM

Re: 'Add to Cart' Alert Message
 
Man, this is entirely too difficult, I'm not an xcart guru, the instructions are SIMPLE. I really have a hard time seeing how anyone could screw this install up. The fact of the matter is they just plain don't work or are wrong entirely, what skin is this supposed to work with?

graffix 03-07-2011 10:33 AM

Re: 'Add to Cart' Alert Message
 
Is there ANYONE on these forums that can offer a better explanation than, yeah, you just got to add all the right code in the right places?

cflsystems 03-07-2011 10:35 AM

Re: 'Add to Cart' Alert Message
 
It works with all skins. You just have to put the code in the files your store uses. For example if you are using 2 column skin you have to edit the files in skin/2column directory if they exist there. Editing these files in skin/common_files will have no effect

graffix 03-07-2011 10:41 AM

Re: 'Add to Cart' Alert Message
 
Ok, thank you for that, that sheds a little light. However, on the skin i'm using these files don't exist in the customer directory, so do I copy them there? I assumed that xcart would default to the ones in the common_files/customer folder if there weren't any for the current skin, is this wrong?

cflsystems 03-07-2011 10:43 AM

Re: 'Add to Cart' Alert Message
 
If the files do not exists in the skin you are using then cart uses the common_skin files

graffix 03-07-2011 10:46 AM

Re: 'Add to Cart' Alert Message
 
Yeah, so I'm back to square one then...I just don't get it. The light and lucid 2 and 3 column don't use their own version, and I've changed the service_head.tpl under /skin/common_files/customer, is this the right file?

cflsystems 03-07-2011 10:58 AM

Re: 'Add to Cart' Alert Message
 
That's what the instructions say.
Do you have the speedup tools for js and css turned on? Try turning them off and see if it works

graffix 03-07-2011 11:28 AM

Re: 'Add to Cart' Alert Message
 
I have a question for the creator of this mod, have you ever installed this mod on a new installation of xcart gold 4.4.2? I really think that I have explored every option with this mod, and I can't get it to work...anyone up to look over what I have completed in teamviewer and offer me their opinion. Also, thanks cflsystems, I did have both of the speed-up tools enabled, but disabling them didn't change anything. This si the response I got from Steve Stoyanov, I believe he authored the original.

Ah ok. You are probably not uploading all files and not making all the calls. The shadow box jquery has to load from <head> section. And do not make the jquery call - XC has it already

cflsystems 03-07-2011 11:38 AM

Re: 'Add to Cart' Alert Message
 
Steve Stoyanov is behind cflsystems so - the same person. The original creator of the mod is Phil (PhilJ above). I did modify it a bit.

The mod works on 4.4.x (not sure about 4.3.x), I installed it on a test and couple live 4.4.x carts so I can confirm to you - it does work. If it's not working for you then you are doing something wrong

graffix 03-07-2011 11:47 AM

Re: 'Add to Cart' Alert Message
 
I just don't get it, it's 4 steps lol. There's not really any way to mess it up, you follow the instructions, it's really easy. It's almost insulting to say I'm doing something wrong with the instructions given. Anyone can follow these instructions. Can I look around in your test installation? I just don't get it.

Duramax 6.6L 03-07-2011 01:22 PM

Re: 'Add to Cart' Alert Message
 
I have installed in my store and it works perfectly.

graffix 03-07-2011 02:29 PM

Re: 'Add to Cart' Alert Message
 
Let me first start with an apology, it took me a while looking at what was happening with firebug to really realize what's going on. I sell products that have lengths, like 6'9", 8' etc. in the product titles. It was the ' or the " that was causing it to not load properly. I created a product simply titled 'Test' and it works perfectly. So, does anyone know how I can get those characters to work in my title, or do I need to change all my product listings so they say feet and inches instead of ' and "? Also, want to thank everyone for their help, it kept pushing me in the right direction and thankfully I now know what the problem is!

cflsystems 03-07-2011 04:24 PM

Re: 'Add to Cart' Alert Message
 
I guess you found a bug in the mod. Find all

{$product.product}

and replace with

{$product.product|escape}

graffix 03-07-2011 05:07 PM

Re: 'Add to Cart' Alert Message
 
I replaced the two instances of {$product.product} in cart_alert.tpl with {$product.product|escape}, uploaded the file, cleared my cache and refreshed, the problem still persists for me. I have definitely isolated it to the product title, when I switch the product title from 8' to 8 foot it works fine. Also, thank you for all your help.

**EDIT**
On a second note...it's also inside of the H2 headers, and I see that the code that you had me change is inside of h2 headers, so i'm a little more clear as to what is going on now. Thanks again for that.

**DOUBLE EDIT**
Looks like ' and " in the sidebar's are also throwing it off...I wish I knew of a workaround for this.

cflsystems 03-07-2011 05:44 PM

Re: 'Add to Cart' Alert Message
 
Try with {$product.product|escape:'quotes'}

graffix 03-07-2011 05:59 PM

Re: 'Add to Cart' Alert Message
 
Quote:

Originally Posted by cflsystems
Try with {$product.product|escape:'quotes'}


It looks like that works for products that are 6'5", but not the 8' products...is that ' a tilde?


**EDIT**
What about this piece of code
{assign var='value' value=$value|replace:'"':'&quot;'}
**SECOND EDIT**
The sidebar issue sems to only effect FireFox, as long as I modify the product title to not include tildes and quotes, IE seems to work fine.

welly 04-28-2011 03:34 PM

Re: 'Add to Cart' Alert Message
 
I've been trying out this mod on our 4.4.2 installation, but I've found it a bit of a struggle to get working. The installation procedure is as simple as can be, and I installed both the original and the modified versions, both with the same results.

To be fair, much of the problem I had already caused. I had modified the products_list.tpl file for layout, and inadvertantly stopped the 'buy now' button from working correctly. Wasted some hours re-fiddling, and got the button working as it should.

Then I reinstated the alert code, but still no joy. It worked fine on the individual product pages, but not on the product list. Or so I thought.

It was actually working on some pages but not others, which is strange since they all work from the same code. I tried deleting some of the products from one of the non-working pages to see if it was a product name issue, but it wasn't.

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.

This isn't a criticism. I love the mod and congratulate the author(s), and can't imagine there ever being a time when I could create something like this. I'm just making my findings available in case someone else sees the same thing. It took me a while to identify.

I presume it stops working because some code is repeated on the page - once in the featured products list, once in the main product list. Even if that is true (I don't know if it is, it's just an uneducated theory) I haven't got a clue how to rectify it.

If anyone has any thoughts on how to overcome this, I'd love to hear them (I am assuming of course that it isn't just something a bit screwy on my site!).

Cheers

Welly

JWait 05-12-2011 02:05 PM

Re: 'Add to Cart' Alert Message
 
I used the "improved" version and it installed easily and seems to work fine. There is one tweak I would like to see... how would I put an "if" statement in it just in case the product added doesn't have any upsell products related to it?


All times are GMT -8. The time now is 06:41 AM.

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