Jump to content

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

Checkout Shipping_Rate Hook Problem Rate Topic   - - - - -

 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 03 October 2019 - 12:15 PM #1

I am trying to hide "(inc tax)" from after the price of the shipping method in the checkout.

 

I have gone into templates / views / checkout / components / shipping_rates.tpl

 

I have modified the code directly in the template for the hook checkout:shipping_rate to:

{$delivery_time = ""}
                        {if $shipping.delivery_time || $shipping.service_delivery_time}
                            {$delivery_time = "(`$shipping.service_delivery_time|default:$shipping.delivery_time`)"}
                        {/if}

                        {if $shipping.rate}
                            {capture assign="rate"}{include file="common/price.tpl" value=$shipping.rate}{/capture}
                            {*if $shipping.inc_tax}
                                {$rate = "`$rate` ("}
                                {if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
                                    {capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
                                    {$rate = "`$rate``$tax` "}
                                {/if}
                                {$inc_tax_lang = __('inc_tax')}
                                {$rate = "`$rate``$inc_tax_lang`)"}
                            {/if*}
                        {elseif fn_is_lang_var_exists("free")}
                            {$rate = __("free")}
                        {else}
                            {$rate = ""}
                        {/if}

Commenting out the tax bit of the code has worked fine when i make the changes directly to the template file.

 

If however i add this same code to shipping_rate.override.tpl and upload it to design/themes/vivashop/templates/addons/my_changes/hooks/checkout the code doesn't work.

 

I can't for the life of me see what i am missing.

 

What am i doing wrong?

 

Is there maybe another way of hiding this text? If i just remove the language text 'inc_tax' i am still left with the ()...

 

Thanks



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 03 October 2019 - 01:50 PM #2

Hello

 

Did you cleare cache ?

What is the name of the file in which you are doing overwrite?

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

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

Posted 04 October 2019 - 05:36 AM #3

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


 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 07 October 2019 - 11:49 AM #4

I have deleted the cache folder and cleared the cache.

 

The hook checkout:shipping_rate is in:

templates / views / checkout / components / shipping_rates.tpl

 

The file with my changed code is:

design/themes/vivashop/templates/addons/my_changes/hooks/checkout/shipping_rate.override.tpl

 

I have added some random text into the override file to see what is being pulled so i can see that the file is being loaded but it in't displaying how i would expect.

 

The random text is being shown outside the shipping method box.

 

The test code i am using in the override is:

aaa{$delivery_time = ""}bbb
                        {if $shipping.delivery_time || $shipping.service_delivery_time}
                            {$delivery_time = "(`$shipping.service_delivery_time|default:$shipping.delivery_time`)"}
                        {/if}
ccc
                        {if $shipping.rate}ddd
                            {capture assign="rate"}{include file="common/price.tpl" value=$shipping.rate}{/capture}
                           eee {if $shipping.inc_tax}
                                {$rate = "`$rate` (11"}
                                {if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
                                    {capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
                                    {$rate = "33`$rate``$tax` 44"}
                                {/if}
                                {$inc_tax_lang = __('inc_tax')}
                                {$rate = "`$rate``$inc_tax_lang`22)"}
                            222{/if}eee
                        {elseif fn_is_lang_var_exists("free")}
                            {$rate = __("free")}fff
                        {else}
                            {$rate = ""}ggg
                        {/if}hhh

and displays as in this image:

sm-error.PNG

 

At least i can see it is seeing the file ok but i'm sure some of these bits should be in the shipping method boxes.



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 07 October 2019 - 12:28 PM #5

Hello

 

I think you should try to change here.

 

<p class="litecheckout__shipping-method__title">{$shipping.shipping}{if $rate} — {$rate nofilter}{/if}</p>

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 07 October 2019 - 01:12 PM #6

Thanks for this line.

 

I've just had a quick look at this. Unfortunately {$rate nofilter} returns both the price and the (inc tax) part. I am trying to stop the display of the (inc tax).

 

What does the nofilter part of the code mean? Can i change this to somthing else to return only the shipping method price?



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 07 October 2019 - 01:21 PM #7

Hello

 

Please change this

 

{$inc_tax_lang = __('inc_tax')}

 

on

 

{$inc_tax_lang = ""}

 

"nofilter" - this means that the variable is displayed without filtering the data (without cutting html markers)

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 07 October 2019 - 01:48 PM #8

If i make this change directly to the template file i get the shipping method price followed by () e.g. £3.00 ().

 

I can see where these brackets are coming from and where to remove them. {$rate = "`$rate` ("} and {$rate = "`$rate``$inc_tax_lang`)"}

 

However when i make the same change to the override file in my_changes nothing happens. This is what is puzzling me...



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 07 October 2019 - 02:13 PM #9

Hello
Comment this parts from code
 
        {*{$rate = "`$rate`"}*}
        {if $shipping.taxed_price && $shipping.taxed_price != $shipping.rate}
        {capture assign="tax"}{include file="common/price.tpl" value=$shipping.taxed_price class="ty-nowrap"}{/capture}
        {*{$rate = "`$rate``$tax` "}*}
        {/if}
        {$inc_tax_lang = __('inc_tax')}
        {*{$rate = "`$rate``$inc_tax_lang`)"}*}
 
And send info if it worked
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl

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

Posted 07 October 2019 - 02:26 PM #10

Looks like this hook is overrided by one more addon. As a result you see your changes, but the final result is received from 3rd party module


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


 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 07 October 2019 - 03:40 PM #11

Thanks for the changes Robert, these make everything display how i'd like. I just can't get it to work using the my_changes addon.

 

I have now tried manually disabling all addons except the my_changes addon, removed the other .tpl files in my_changes and reverted to the default template.

 

Unfortunately i am still seeing the (inc tax) displayed.



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 07 October 2019 - 05:34 PM #12

Hello

 

If your prints that you do in the main file show up, it means that this hook is not overwritten (and this suggests your screen from the previous post)
If it's not overwritten, it means something is wrong with your addon. Maybe the space got stuck somewhere?
Maybe try transferring my_changes to responsive from vivashop?
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl

 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 23 posts

Posted 08 October 2019 - 12:00 PM #13

The addon is working ok for other modified templates that i have put into my_changes. It is just this one.

 

I'll keep playing around and post back if i discover what is causing this. I'll just make the changes to the main template files for the meantime.

 

Thanks for your help



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 899 posts

Posted 08 October 2019 - 12:11 PM #14

Hello

 

You are welcome :)

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl