Forums / Contribution-Writing Guidelines / Change "Add to Cart" to "Add Another"?

Change "Add to Cart" to "Add Another"?

Locked

Started by yorkshirepetshop on 31 Mar 2010, 1:00 PM · Views: 1,688

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
31 Mar 2010, 1:00 PM
#1
yorkshirepetshop avatar

yorkshirepetshop

New Zenner

Join Date:
Jun 2007
Posts:
12
Plugin Contributions:
0

Change "Add to Cart" to "Add Another"?

Hi

I was wondering if it was possible to do the following:

When on a product page (or product listing page) I add an item to the cart. I then want to the add to cart text to change from "add to cart" to "add another" for that product.

So: If ProductID in cart text = "add another" else text = "add to cart".

I've tried to do it myself but I'm struggling to get a list of IDs that are in the cart and then how to query the list on each product page or each product on the product listing page.

Any tips or ideas would be great. I think it would improve usability of my site greatly.

Many thanks

Warren

31 Mar 2010, 2:02 PM
#2
yorkshirepetshop avatar

yorkshirepetshop

New Zenner

Join Date:
Jun 2007
Posts:
12
Plugin Contributions:
0

Re: Change "Add to Cart" to "Add Another"?

I figured it out!

for the product detail page:

if ($_SESSION['cart']->in_cart($_GET['products_id'])) {  $cstate = 'Add Another'; } else {$cstate = 'Buy Now';}
```For the product listing page:
```php
if ($_SESSION['cart']->in_cart($listing->fields['products_id'])) { $cstate = 'Add Another'; } else {$cstate = 'Buy Now';}

Gonna have some fun with this now. :D

Thanks

Warren

1 Apr 2010, 11:14 AM
#3
dainteegurl avatar

dainteegurl

New Zenner

Join Date:
Apr 2008
Posts:
12
Plugin Contributions:
0

Re: Change "Add to Cart" to "Add Another"?

Can I ask where you found this? I'm looking to change the wording of Add to Cart to something else. Thanks!

2 Apr 2010, 3:27 PM
#4
yorkshirepetshop avatar

yorkshirepetshop

New Zenner

Join Date:
Jun 2007
Posts:
12
Plugin Contributions:
0

Re: Change "Add to Cart" to "Add Another"?

I've been playing with this today and it doesn't always work.

I think it's because it adds a session id to the array.

Sometimes the array has this:
Array ( [id] => 1841 ...

and it works, other times it has this:

Array ( [id] => 1477:a4e70f439369b7abdecbcb784aa75ba7

which stops my method working.

If anyone knows how I strip the : and the stuff after it then it should work. I'm not to good with arrays so any help would be appreciated.

@dainteegurl if I get this working I'll show you how I've done it.

Cheers

Warren