Hi guys, I need some assistance I want to change button text "Add to cart" on specific product i.e. products with price 0.00 to "Order" while rest of the products are normal
Example: "Add to cart" text become "Order" only for http://www.mysite.com/index.php?route=p ... uct_id=195
Thanks!
Example: "Add to cart" text become "Order" only for http://www.mysite.com/index.php?route=p ... uct_id=195
Thanks!
Hey,
In catalog / language / english (or your language) / english.php
Find:
After Add:
In catalog / controller / product / product.php
Find:
Add After:
In catalog / view / theme / <your theme> / template / product / product.tpl
Find:
Replace With:
Find:
Replace With:
This will make any product with a price of $0.00 show "Order" instead of "Add To Cart".
You will have to perform similar modifications to the category files / modules / etc. in order for this to be universally on your site. This will only modify the product page.
Joel.
In catalog / language / english (or your language) / english.php
Find:
Code: Select all
$_['button_cart'] = 'Add to Cart';
Code: Select all
$_['button_order] = 'Order';
Find:
Code: Select all
$this->data['button_cart'] = $this->language->get('button_cart');
Code: Select all
$this->data['button_order'] = $this->language->get('button_order');
Find:
Code: Select all
<a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a></div>
Code: Select all
<?php if ($price > 0) { ?>
<a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a></div>
<?php } else { ?>
<a id="button-cart" class="button"><span><?php echo $button_order; ?></span></a></div>
<?php } ?>
Code: Select all
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div>
Code: Select all
<?php if ($product['price'] > 0) { ?>
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div>
<?php } else { ?>
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_order; ?></span></a></div>
<?php } ?>
You will have to perform similar modifications to the category files / modules / etc. in order for this to be universally on your site. This will only modify the product page.
Joel.
Thank you Joel!
Everything went OK except messages from error log saying undefined variable button_order also I couldn't find what and where to change to make this global to my site.
Probably I'll gave up for now until full solution, I appreciate you help!
Thank again.
Todor
Everything went OK except messages from error log saying undefined variable button_order also I couldn't find what and where to change to make this global to my site.
Probably I'll gave up for now until full solution, I appreciate you help!
Thank again.
Todor
Take a look at this module:
http://www.opencart.com/index.php?route ... on_id=4139
I can also do a custom modifications to the module, according to your needs
http://www.opencart.com/index.php?route ... on_id=4139
I can also do a custom modifications to the module, according to your needs

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart
OpenCart Addons wrote:Hey,
In catalog / language / english (or your language) / english.php
Find:After Add:Code: Select all
$_['button_cart'] = 'Add to Cart';
In catalog / controller / product / product.phpCode: Select all
$_['button_order] = 'Order';
Find:Add After:Code: Select all
$this->data['button_cart'] = $this->language->get('button_cart');
In catalog / view / theme / <your theme> / template / product / product.tplCode: Select all
$this->data['button_order'] = $this->language->get('button_order');
Find:Replace With:Code: Select all
<a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a></div>
Find:Code: Select all
<?php if ($price > 0) { ?> <a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a></div> <?php } else { ?> <a id="button-cart" class="button"><span><?php echo $button_order; ?></span></a></div> <?php } ?>
Replace With:Code: Select all
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div>
This will make any product with a price of $0.00 show "Order" instead of "Add To Cart".Code: Select all
<?php if ($product['price'] > 0) { ?> <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div> <?php } else { ?> <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_order; ?></span></a></div> <?php } ?>
You will have to perform similar modifications to the category files / modules / etc. in order for this to be universally on your site. This will only modify the product page.
Joel.
thanks a ton!!!
certainly it helped a lot. but not i'm stuck with a problem,
what i want is:
when someone clicks on "order" button (i.e. when a price is 0), I want to redirect it to an external link.
and when they click on "add to cart" (i.e. when price is > 0), it should add the item to cart as normal. (as it does right now)
your help will be highly appreciated!!!
One of the ways to make your store more unique and interesting is to change some of the text strings that are common for all online stores. This is why in this article we will show you how to change the “Add to Cart” text to something different.
How?
Changing the button name is actually quite easy. You just have to change the language string for that phrase and you are good to go. I will show you how to do this step by step. In the following example we will change the “Add to Cart” string for the English language, but this way is applicable for all languages on your store. Lets go!
Access your store’s files.
Navigate to catalog/language/english/default.php.
Find the following string:
1
$_['button_cart'] = 'Add to Cart';
Replace it with:
1
$_['button_cart'] = 'Order This';
That’s it!
In the example above, we are changing the phrase with “Get it!”, but you can change it to whatever you want it to be. By doing this change, you will modify the string globally and it will not matter what template you are using, as long as the button text is not hardcoded in it.
Opencart Expert speziasoft
How?
Changing the button name is actually quite easy. You just have to change the language string for that phrase and you are good to go. I will show you how to do this step by step. In the following example we will change the “Add to Cart” string for the English language, but this way is applicable for all languages on your store. Lets go!
Access your store’s files.
Navigate to catalog/language/english/default.php.
Find the following string:
1
$_['button_cart'] = 'Add to Cart';
Replace it with:
1
$_['button_cart'] = 'Order This';
That’s it!

In the example above, we are changing the phrase with “Get it!”, but you can change it to whatever you want it to be. By doing this change, you will modify the string globally and it will not matter what template you are using, as long as the button text is not hardcoded in it.
Opencart Expert speziasoft
One of the ways to make your store more unique and interesting is to change some of the text strings that are common for all online stores. This is why in this article we will show you how to change the “Add to Cart” text to something different.
How?
Changing the button name is actually quite easy. You just have to change the language string for that phrase and you are good to go. I will show you how to do this step by step. In the following example we will change the “Add to Cart” string for the English language, but this way is applicable for all languages on your store. Lets go!
Access your store’s files.
Navigate to catalog/language/english/default.php.
Find the following string:
1
$_['button_cart'] = 'Add to Cart';
Replace it with:
1
$_['button_cart'] = 'order this!';
That’s it!
In the example above, we are changing the phrase with “Get it!”, but you can change it to whatever you want it to be. By doing this change, you will modify the string globally and it will not matter what template you are using, as long as the button text is not hardcoded in it.
How?
Changing the button name is actually quite easy. You just have to change the language string for that phrase and you are good to go. I will show you how to do this step by step. In the following example we will change the “Add to Cart” string for the English language, but this way is applicable for all languages on your store. Lets go!
Access your store’s files.
Navigate to catalog/language/english/default.php.
Find the following string:
1
$_['button_cart'] = 'Add to Cart';
Replace it with:
1
$_['button_cart'] = 'order this!';
That’s it!
In the example above, we are changing the phrase with “Get it!”, but you can change it to whatever you want it to be. By doing this change, you will modify the string globally and it will not matter what template you are using, as long as the button text is not hardcoded in it.
Who is online
Users browsing this forum: No registered users and 42 guests