Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Change Add To Cart Button Name For Out Of Stock Products Rate Topic   - - - - -

 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 07 April 2016 - 07:40 AM #1

Hi guys,

i want to make Add To Cart  button keep visible when my stock is 0 and change it text

is there any way for doing this?

 

Thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 07 April 2016 - 09:12 AM #2

Settings -> General -> Allow negative amount in inventory

 

As for the label, it is required to change the following file:

 

design/themes/YOUR_THEME/templates/common/product_data.tpl

 

The following code 

{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}

should be replaced with

{if $product_amount <= 0}
{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta but_text=__('your_language_variable')}
{else}
{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}
{/if}

Then add new language variable and clear cache

 

(!) Not tested


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • majerfra
  • Advanced Member
  • Trial users
  • Join Date: 04-Oct 11
  • 134 posts

Posted 07 April 2016 - 11:31 AM #3

Hey man, I work fine, but how can be done, that

{if $product_amount <= 0} 

show special text, not "In stock"?

 

Thank you

Frank



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 07 April 2016 - 01:45 PM #4

Hey man, I work fine, but how can be done, that

{if $product_amount <= 0} 

show special text, not "In stock"?

 

Thank you

Frank

 

Frank, your question is not quite clear. Please clarify


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 08 April 2016 - 03:17 AM #5

Settings -> General -> Allow negative amount in inventory

 

As for the label, it is required to change the following file:

 

design/themes/YOUR_THEME/templates/common/product_data.tpl

 

The following code 

{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}

should be replaced with

{if $product_amount <= 0}
{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta but_text=__('your_language_variable')}
{else}
{include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}
{/if}

Then add new language variable and clear cache

 

(!) Not tested

 

Hi thanks for your reply,

i've test this and my button still not shown when my stock is 0

when i test using echo, my echo is stop shown after this condition

{capture name="buttons_product"}

how to fix this?



 
  • majerfra
  • Advanced Member
  • Trial users
  • Join Date: 04-Oct 11
  • 134 posts

Posted 08 April 2016 - 06:14 AM #6

Frank, your question is not quite clear. Please clarify

Dear eComLabs

{if $product_amount <= 0}

if I use your code to show custom button as you advice in post#2 show that item is "In stock"

I want

{if $product_amount <= 0}

to show some other text, maybe "On request" or any other ....

Thank you for your very useful advices.

Frank



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 08 April 2016 - 07:14 AM #7

Dear eComLabs

{if $product_amount <= 0}

if I use your code to show custom button as you advice in post#2 show that item is "In stock"

I want

{if $product_amount <= 0}

to show some other text, maybe "On request" or any other ....

Thank you for your very useful advices.

Frank

 

In the product_data.tpl file find where the in_stock language variable is used and add new check to the code


Hi thanks for your reply,

i've test this and my button still not shown when my stock is 0

when i test using echo, my echo is stop shown after this condition

{capture name="buttons_product"}

how to fix this?

 

Did you check the corresponding setting at first? Please check first line of our post


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • majerfra
  • Advanced Member
  • Trial users
  • Join Date: 04-Oct 11
  • 134 posts

Posted 08 April 2016 - 07:45 AM #8

In the product_data.tpl file find where the in_stock language variable is used and add new check to the code

 

Can you help me with the code, I didn't understand you.

Thank you in advance

Frank



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 08 April 2016 - 07:54 AM #9

Can you help me with the code, I didn't understand you.

Thank you in advance

Frank

 

For example, replace

{__("in_stock")}

with

{if $product_amount <= 0}{__("my_custom_lang_var")}{else}{__("in_stock")}{/if}

Then just add new language variable


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • majerfra
  • Advanced Member
  • Trial users
  • Join Date: 04-Oct 11
  • 134 posts

Posted 08 April 2016 - 08:22 AM #10

For example, replace

{__("in_stock")}

with

{if $product_amount <= 0}{__("my_custom_lang_var")}{else}{__("in_stock")}{/if}

Then just add new language variable

 

Wauuuu, works fineeee!

Only great men can share their knowledge.

Thank you sooo much.

Frank



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 08 April 2016 - 01:37 PM #11

You are welcome! :)


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • majerfra
  • Advanced Member
  • Trial users
  • Join Date: 04-Oct 11
  • 134 posts

Posted 11 April 2016 - 11:52 AM #12

Wauuuu, works fineeee!

Only great men can share their knowledge.

Thank you sooo much.

Frank

 

Hi EcomLabs

As I said works fine, but if I have active:

Show number of available products: in Settings/Appearance in doesnt show anything.

any help, please?

Frank



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 11 April 2016 - 02:29 PM #13

You can find the {__("in_stock")} code in several strings in the file. Try to replace it in all places


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 03 June 2016 - 01:37 AM #14

In the product_data.tpl file find where the in_stock language variable is used and add new check to the code


 

Did you check the corresponding setting at first? Please check first line of our post

 

Hi eComLabs,

after i show this to my team, they said that we only need show "Add to Cart" for 0 stock (which in this case, it will become like pre order) for some product

i've been thinking for make a product category for product that will be able to pre order

is this possible do it like this?

 

Thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 03 June 2016 - 07:03 AM #15

For only 0 in stock you can use the {if $product_amount == 0} condition. I do not think that you need to create separate category for these products 


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 03 June 2016 - 08:02 AM #16

For only 0 in stock you can use the {if $product_amount == 0} condition. I do not think that you need to create separate category for these products 

 

well i don't want to all of my product can have "Pre Order", and just some product

that's why i think i will make a category for product that can pre order, so if product is belong on this category, even if my stock is below 0, my "Add To Cart" button will be shown up as "Pre Order" and for product that's not in this category, i will not show "Add To Cart" button



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 03 June 2016 - 02:08 PM #17

Thank you clarification. The product category can be checked with the following code:

{if $product.main_category == 123}
    ....
{/if}

where 123 - is the ID of the required category


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 24 June 2016 - 07:08 AM #18

Thank you clarification. The product category can be checked with the following code:

{if $product.main_category == 123}
    ....
{/if}

where 123 - is the ID of the required category

 

Hi eComLabs,

i've tried that and it work, thanks

can i ask where is qty picker too?

because i've tried to looking around product.tpl but i'm not found it

 

EvnLNUk.png

 

because i think for product that can't pre order this picker is useless, so i want to hide it

 

Thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19775 posts

Posted 27 June 2016 - 08:14 AM #19

Search in the same file by "qty"


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • 1210891
  • Advanced Member
  • Trial users
  • Join Date: 14-Mar 16
  • 75 posts

Posted 30 June 2016 - 08:48 AM #20

Search in the same file by "qty"

 

Thanks, i found it :)