Jump to content

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

How To Add Text Block Under "add To Cart" Button Rate Topic   - - - - -

 
  • ghostrider
  • Junior Member
  • Members
  • Join Date: 05-Jan 11
  • 175 posts

Posted 18 July 2016 - 05:45 AM #1

I want to add a text block under the "Add to Cart" button to all products in a category.

 

Is there some easy solution to achieve this?

 

 

Attached Files



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

Posted 18 July 2016 - 07:07 AM #2

Enable the My changes module, create the following file:

 

design/themes/YOUR_THEME/templates/addons/my_changes/hooks/products/product_detail_bottom.pre.tpl

 

put your content to this file and clear the cache then


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 руб.


 
  • ghostrider
  • Junior Member
  • Members
  • Join Date: 05-Jan 11
  • 175 posts

Posted 18 July 2016 - 07:32 AM #3

Thank you for the instruction. Is there any way to show this to only a few products in a specific category, not all products?



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

Posted 18 July 2016 - 07:40 AM #4

You can use the promo text field to show additional text. There is an ability to export and import it. The content of the new file should be 

                {if $product.promo_text}
                <div class="ty-product-block__note">
                    {$product.promo_text nofilter}
                </div>
                {/if}

Note that it will be required to remove the same code from the product template:

 

design/themes/YOUR_THEME/templates/blocks/product_templates/default_template.tpl


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 руб.


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 968 posts

Posted 28 August 2016 - 06:07 PM #5

I want to add a text block under the "Add to Cart" button to all products in a category.

 

Is there some easy solution to achieve this?

 

Hi I just find your post ghostrider by looking for something I actually wanted to find out but since I am here, what may I ask where or are you trying to accomplish with this block ? Is it a universal kind of text you want to appear for all products related to one specific category or just a text block that can be individually filled for each individual product ?

 


CS Cart Evangelist - running CS Cart 4.7.4 in three domains


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

Posted 29 August 2016 - 07:38 AM #6

Hi I just find your post ghostrider by looking for something I actually wanted to find out but since I am here, what may I ask where or are you trying to accomplish with this block ? Is it a universal kind of text you want to appear for all products related to one specific category or just a text block that can be individually filled for each individual product ?

 

 

Use promo text. It can be exported and imported for specific 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 руб.


 
  • sybernetics
  • Newbie
  • Trial users
  • Join Date: 29-Nov 13
  • 11 posts

Posted 07 August 2018 - 12:43 AM #7

Hi Gurus,

 

Can anyone please advise me how I can get the title and the rest of the information take full width to the right and the promo text to appear under the title as per the attached screenshot?

 

Cheers!

Attached File  promo and title.jpg   84.35KB   0 downloads



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

Posted 07 August 2018 - 06:26 AM #8

You should change the following template

 

design/themes/THEME/templates/blocks/product_templates/default_template.tpl

 

For example, move code from the products:main_info_title hook to separate HTML block with SMARTY support and locate it above the Main content block


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 руб.


 
  • sybernetics
  • Newbie
  • Trial users
  • Join Date: 29-Nov 13
  • 11 posts

Posted 08 August 2018 - 12:35 AM #9

You should change the following template

 

design/themes/THEME/templates/blocks/product_templates/default_template.tpl

 

For example, move code from the products:main_info_title hook to separate HTML block with SMARTY support and locate it above the Main content block

 

Thanks for your reply. I cant seem to make it work. Either nothing happens when I move the code around or the page becomes UNAVAILABLE. Here is the code:
 

{script src="js/tygh/exceptions.js"}
<div class="ty-product-block ty-product-detail">
    <div class="ty-product-block__wrapper clearfix">
    {hook name="products:view_main_info"}
        {if $product}
            {assign var="obj_id" value=$product.product_id}
            {include file="common/product_data.tpl" product=$product but_role="big" but_text=__("add_to_cart")}
            <div class="ty-product-block__img-wrapper">
                {hook name="products:image_wrap"}
                    {if !$no_images}
                        <div class="ty-product-block__img cm-reload-{$product.product_id}" id="product_images_{$product.product_id}_update">
 
                            {assign var="discount_label" value="discount_label_`$obj_prefix``$obj_id`"}
                            {$smarty.capture.$discount_label nofilter}
 
                            {include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y" image_width=$settings.Thumbnails.product_details_thumbnail_width image_height=$settings.Thumbnails.product_details_thumbnail_height}
                        <!--product_images_{$product.product_id}_update--></div>
                    {/if}
                {/hook}
            </div>
            <div class="ty-product-block__left">
                {assign var="form_open" value="form_open_`$obj_id`"}
                {$smarty.capture.$form_open nofilter}
 
                {hook name="products:main_info_title"}
                    {if !$hide_title}
                        <h1 class="ty-product-block-title" {live_edit name="product:product:{$product.product_id}"}><bdi>{$product.product nofilter}</bdi></h1>
                    {/if}
 
                    {hook name="products:brand"}
                        {hook name="products:brand_default"}
                            <div class="brand">
                                {include file="views/products/components/product_features_short_list.tpl" features=$product.header_features}
                            </div>
                        {/hook}
                    {/hook}
                {/hook}
 
                {assign var="old_price" value="old_price_`$obj_id`"}
                {assign var="price" value="price_`$obj_id`"}
                {assign var="clean_price" value="clean_price_`$obj_id`"}
                {assign var="list_discount" value="list_discount_`$obj_id`"}
                {assign var="discount_label" value="discount_label_`$obj_id`"}
 
                {hook name="products:promo_text"}
                {if $product.promo_text}
                <div class="ty-product-block__note">
                    {$product.promo_text nofilter}
                </div>
                {/if}
                {/hook}
 
                <div class="{if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}prices-container {/if}price-wrap">
                    {if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}
                        <div class="ty-product-prices">
                            {if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price nofilter}{/if}
                    {/if}
 
                    {if $smarty.capture.$price|trim}
                        <div class="ty-product-block__price-actual">
                            {$smarty.capture.$price nofilter}
                        </div>
                    {/if}
 
                    {if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}
                            {$smarty.capture.$clean_price nofilter}
                            {$smarty.capture.$list_discount nofilter}
                        </div>
                    {/if}
                </div>
 
                {if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}
                <div class="ty-product-block__option">
                    {assign var="product_options" value="product_options_`$obj_id`"}
                    {$smarty.capture.$product_options nofilter}
                </div>
                {if $capture_options_vs_qty}{/capture}{/if}
 
                <div class="ty-product-block__advanced-option clearfix">
                    {if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}
                    {assign var="advanced_options" value="advanced_options_`$obj_id`"}
                    {$smarty.capture.$advanced_options nofilter}
                    {if $capture_options_vs_qty}{/capture}{/if}
                </div>
 
                <div class="ty-product-block__sku">
                    {assign var="sku" value="sku_`$obj_id`"}
                    {$smarty.capture.$sku nofilter}
                </div>
 
                {if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}
                <div class="ty-product-block__field-group">
                    {assign var="product_amount" value="product_amount_`$obj_id`"}
                    {$smarty.capture.$product_amount nofilter}
 
                    {assign var="qty" value="qty_`$obj_id`"}
                    {$smarty.capture.$qty nofilter}
 
                    {assign var="min_qty" value="min_qty_`$obj_id`"}
                    {$smarty.capture.$min_qty nofilter}
                </div>
                {if $capture_options_vs_qty}{/capture}{/if}
 
                {assign var="product_edp" value="product_edp_`$obj_id`"}
                {$smarty.capture.$product_edp nofilter}
 
                {if $show_descr}
                {assign var="prod_descr" value="prod_descr_`$obj_id`"}
                    <h3 class="ty-product-block__description-title">{__("description")}</h3>
                    <div class="ty-product-block__description">{$smarty.capture.$prod_descr nofilter}</div>
                {/if}
 
                {if $capture_buttons}{capture name="buttons"}{/if}
                <div class="ty-product-block__button">
                    {if $show_details_button}
                        {include file="buttons/button.tpl" but_href="products.view?product_id=`$product.product_id`" but_text=__("view_details") but_role="submit"}
                    {/if}
 
                    {assign var="add_to_cart" value="add_to_cart_`$obj_id`"}
                    {$smarty.capture.$add_to_cart nofilter}
 
                    {assign var="list_buttons" value="list_buttons_`$obj_id`"}
                    {$smarty.capture.$list_buttons nofilter}
                </div>
                {if $capture_buttons}{/capture}{/if}
 
                {assign var="form_close" value="form_close_`$obj_id`"}
                {$smarty.capture.$form_close nofilter}
 
                {hook name="products:product_detail_bottom"}
                {/hook}
 
                {if $show_product_tabs}
                {include file="views/tabs/components/product_popup_tabs.tpl"}
                {$smarty.capture.popupsbox_content nofilter}
                {/if}
            </div>
        {/if}
 
    {/hook}
    </div>
 
    {if $smarty.capture.hide_form_changed == "Y"}
        {assign var="hide_form" value=$smarty.capture.orig_val_hide_form}
    {/if}
 
    {if $show_product_tabs}
        {hook name="products:product_tabs"}
            {include file="views/tabs/components/product_tabs.tpl"}
 
            {if $blocks.$tabs_block_id.properties.wrapper}
                {include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
            {else}
                {$smarty.capture.tabsbox_content nofilter}
            {/if}
        {/hook}
    {/if}
</div>
 
<div class="product-details">
</div>
 
{capture name="mainbox_title"}{assign var="details_page" value=true}{/capture}


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

Posted 08 August 2018 - 06:47 AM #10

 

Thanks for your reply. I cant seem to make it work. Either nothing happens when I move the code around or the page becomes UNAVAILABLE. Here is the code:

 

 

How do you add new code? Please provide us with the peace of code you added


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 руб.


 
  • sybernetics
  • Newbie
  • Trial users
  • Join Date: 29-Nov 13
  • 11 posts

Posted 09 August 2018 - 12:26 AM #11

How do you add new code? Please provide us with the peace of code you added

I didn't add anything. I just moved some parts of the code. Can you please show me how its done, I'm obviously not that good with it :(



 
  • leeshields
  • Member
  • Members
  • Join Date: 09-Nov 10
  • 67 posts

Posted 09 August 2018 - 04:32 PM #12

Hi all, I'd like to move my description up under the price, which is very similar to this. I've had a good luck through templates but I cant seem to get any changes to take effect.

Thanks


Lee



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

Posted 10 August 2018 - 05:23 AM #13

Hi all, I'd like to move my description up under the price, which is very similar to this. I've had a good luck through templates but I cant seem to get any changes to take effect.

 

After template is changed, do not forget to clear cache or delete the var/cache directory manually


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 руб.


 
  • leeshields
  • Member
  • Members
  • Join Date: 09-Nov 10
  • 67 posts

Posted 10 August 2018 - 11:27 AM #14

I know about clearing the cache thanks, the problem is finding exactly which template to start editing and how to prevent it being overwritten after an update. I've just been adding some text to various templates and checking just to try and ID which template is which and still can't find the correct one. The Bright Theme templates don't have the product detail template in there to start with?

 

Lee



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

Posted 10 August 2018 - 01:22 PM #15

I know about clearing the cache thanks, the problem is finding exactly which template to start editing and how to prevent it being overwritten after an update. I've just been adding some text to various templates and checking just to try and ID which template is which and still can't find the correct one. The Bright Theme templates don't have the product detail template in there to start with?

 

Check parent theme (design/themes/responsive for the bright theme)


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 руб.


 
  • sybernetics
  • Newbie
  • Trial users
  • Join Date: 29-Nov 13
  • 11 posts

Posted 20 August 2018 - 01:34 AM #16

You should change the following template

 

design/themes/THEME/templates/blocks/product_templates/default_template.tpl

 

For example, move code from the products:main_info_title hook to separate HTML block with SMARTY support and locate it above the Main content block

 

Thanks for your help, I was able to make the required changes.

 

My next question however, is how to keep this template safe from getting overwritten when the CS-Cart upgrades?



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

Posted 20 August 2018 - 06:16 AM #17

Just override the products:main_info_title hook with my changes module (for example, add empty div tag). Changes in the default_template.tpl file are not required in this case

 

design/themes/YOUR_THEME/templates/addons/my_changes/hooks/products/main_info_title.override.tpl


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 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11001 posts

Posted 20 August 2018 - 06:39 PM #18

You can just use an html comment rather than an empty div so it's clear. An override just looks for html content after whitespace is removed.  If there is none, then the original hook block will be used.  If it's non-zero, then that content will be used.

 

I'd suggest you use a comment similar to:

<!-- my_changes/hooks/products/main_info_title.override.tpl overrides the main content -->

 

This makes it clear to anyone doing a code inspection or other review.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • sybernetics
  • Newbie
  • Trial users
  • Join Date: 29-Nov 13
  • 11 posts

Posted 23 August 2018 - 12:44 AM #19

Thanks for your help guys!