How to add a Carrier in version 4?

[quote name='eComLabs' timestamp='1405498915' post='187638']

At first, make a backup of the following file:


design/themes/VIVASHOP_THEME/mail/templates/shipments/shipment_products.tpl



and replace the original file with this one:


design/themes/basic/mail/templates/shipments/shipment_products.tpl



Hope that helps.

[/quote]



Thanks eComLab for reverting back on this post. What I observe is that I don't [size=4]have [font=arial,helvetica,sans-serif][color=#000000]design[/color][color=#666600]/[/color][color=#000000]themes[/color][color=#666600]/[/color][color=#000000]basic path available in my root directory. Seems like it got replaced by the VIVAShop theme installation. But when I downloaded the fresh CS-cart, there also the file under [/color][/font][/size]design/themes/basic/mail/templates/shipments/shipment_products.tpl is same to as of VIVAShop.



Seems like problem is something else. Kindly help on this.



NOTE: Do you think if I create basic/mail/templates/shipments/shipment_products.tpl path under design/themes/ will make this work?

[quote]Thanks Simtech,

These changes worked for me. Thanking you again for nailing this down.[/quote]



We are glad to help you.

As regards the other issue, as far as I see from the .doc file provided earlier, you used your custom carrier in the first case and the standard one in the second one. So it seems to me that the URL was not set for the new carrier. Please check if the modifications Swimcommunications mentioned are applied properly:

[quote name='swimcommunications' timestamp='1405391190' post='187533']

3. Open the design/themes/[YOUR_ACTIVE_THEME]/templates/common/carriers.tpl file of your CS-Cart installation and add this part of code:

{elseif $carrier == "NEW_CARRIER"}
{$url = "http://YOUR_TRACKING_URL"}
{$carrier_name = __("NEW_CARRIER")}




below this one:

{elseif $carrier == "temando"}
{$url = "https://temando.com/education-centre/support/track-your-item?token=`$tracking_number`"}
{$carrier_name = __("temando")}




where NEW_CARRIER should be replaced with your carrier name and YOUR_TRACKING_URL with the URL provided by your shipping carrier to track orders. Save the file.



Add the same part of code to the design/themes/[YOUR_ACTIVE_THEME]/mail/templates/common/carriers.tpl file of your CS-Cart installation. Save the file and check the results.

[/quote]

Please note that in case you create multiple custom carriers, you should add such parts of code for each of them. I hope this will help.

Hi Simtech,

We have followed each and every step which were given by swimcom but problem is same what I have reported that Tracking Links in emails are not Clickable. Instead of adding NEW CARRIERS to existing, we have removed existing and replaced them with new ones at below mentioned paths:



[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/design/themes/vivashop/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/design/themes/vivashop/mail/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/design/themes/responsive/templates/common/carriers.tpl[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/design/themes/responsive/mail/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/vivashop/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/vivashop/mail/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/responsive/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/responsive/mail/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/basic/templates/common/carriers.tpl [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/var/themes_repository/basic/mail/templates/common/carriers.tpl [/font][/color]



Below is the code in old file.

{hook name="carriers:list"}
{if $carrier == "usps"}
{$url = "https://tools.usps.com/go/TrackConfirmAction_input?strOrigTrackNum=`$tracking_number`"}
{$carrier_name = __("usps")}
{elseif $carrier == "ups"}
{$url = "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=`$tracking_number`"}
{$carrier_name = __("ups")}
{elseif $carrier == "fedex"}
{$url = "http://fedex.com/Tracking?action=track&tracknumbers=`$tracking_number`"}
{$carrier_name = __("fedex")}
{elseif $carrier == "aup"}
{$url = "http://auspost.com.au/track/track.html?id=`$tracking_number`"}
{$carrier_name = __("australia_post")}
{elseif $carrier == "can"}
{$url = "http://www.canadapost.com/cpotools/apps/track/personal/findByTrackNumber?trackingNumber=`$tracking_number`"}
{$carrier_name = __("canada_post")}
{elseif $carrier == "dhl" || $shipping.carrier == "ARB"}
{$url = "http://www.dhl-usa.com/en/express/tracking.shtml?ShipmentNumber=`$tracking_number`"}
{$carrier_name = __("dhl")}
{elseif $carrier == "swisspost"}
{$url = "http://www.post.ch/swisspost-tracking?formattedParcelCodes=`$tracking_number`"}
{$carrier_name = __("chp")}
{elseif $carrier == "temando"}
{$url = "https://temando.com/education-centre/support/track-your-item?token=`$tracking_number`"}
{$carrier_name = __("temando")}
{else}
{$url = ""}
{$carrier_name = $carrier}
{/if}{/hook}
{capture name="carrier_name"}
{$carrier_name}
{/capture}{capture name="carrier_url"}
{$url nofilter}
{/capture}




Replaced by code.


{hook name="carriers:list"}
{if $carrier == "aramex"}
{$url = "http://www.aramex.com/track-results-multiple.aspx?ShipmentNumber=`$tracking_number`"}
{$carrier_name = __("Aramex")}
{elseif $carrier == "blazeflash"}
{$url = "http://www.blazeflash.com/TrackDetail.aspx?awbno=`$tracking_number`"}
{$carrier_name = __("Blazeflash")}
{elseif $carrier == "bluedart"}
{$url = "http://bluedart.com/servlet/RoutingServlet?action=awbquery&awb=awb&handler=tnt&numbers=`$tracking_number`"}
{$carrier_name = __("Bluedart")}
{elseif $carrier == "delhivery"}
{$url = "http://track.delhivery.com/p/`$tracking_number`"}
{$carrier_name = __("Delhivery")}
{elseif $carrier == "dhl"}
{$url = "http://www.dhl.co.in/content/in/en/express/tracking.shtml?brand=DHL&AWB=`$tracking_number`"}
{$carrier_name = __("DHL")}
{elseif $carrier == "dtdc"}
{$url = "http://dtdc.com/tracking/tracking.asp`$tracking_number`"}
{$carrier_name = __("DTDC")}
{elseif $carrier == "ecomex"}
{$url = "http://eepl.ecomexpress.in/track_me/scan_open/1/?awb=`$tracking_number`&order="}
{$carrier_name = __("eComExpress")}
{elseif $carrier == "fedex"}
{$url = "http://fedex.com/Tracking?action=track&tracknumbers=`$tracking_number`"}
{$carrier_name = __("Fedex")}
{elseif $carrier == "ffc"}
{$url = "http://www.firstflight.net/n_contrac_new_12Digit_New.asp?tracking1=`$tracking_number`"}
{$carrier_name = __("First Flight")}
{elseif $carrier == "gojavas"}
{$url = "http://track.gojavas.com/Track/MyTrackResult.aspx?Dockno=`$tracking_number`&Flag=D"}
{$carrier_name = __("goJavas")}
{elseif $carrier == "India Post"}
{$url = "http://services.cept.gov.in/Speednettracking/Track.aspx?articlenumber=`$tracking_number`"}
{$carrier_name = __("India Post")}
{elseif $carrier == "overnitex"}
{$url = "http://www.overnitenet.com/Webtrack.aspx`$tracking_number`"}
{$carrier_name = __("Overnite Express")}
{elseif $carrier == "redex"}
{$url = "https://www.getsetred.net/Tracking?WayBills=`$tracking_number`_WayBill&Type=WayBill&IsOutSidePage=yes&Ref=`$tracking_number`"}
{$carrier_name = __("Red Express")}
{elseif $carrier == "tpc"}
{$url = "http://www.tpcindia.com/Tracking2014.aspx?id=`$tracking_number`&type=0&service=0#"}
{$carrier_name = __("The Professional Couriers")}{else}
{$url = ""}
{$carrier_name = $carrier}
{/if}
{/hook}{capture name="carrier_name"}
{$carrier_name}
{/capture}
{capture name="carrier_url"}
{$url nofilter}
{/capture}




Kindly refer post http://forum.cs-cart…post__p__187654

[attachment=8230:Shipping Mail Issue.doc]

Shipping Mail Issue.doc

[quote name='fleaffair' timestamp='1405508421' post='187654']

Thanks eComLab for reverting back on this post. What I observe is that I don't [size=4]have [font=arial,helvetica,sans-serif][color=#000000]design[/color][color=#666600]/[/color][color=#000000]themes[/color][color=#666600]/[/color][color=#000000]basic path available in my root directory. Seems like it got replaced by the VIVAShop theme installation. But when I downloaded the fresh CS-cart, there also the file under [/color][/font][/size]design/themes/basic/mail/templates/shipments/shipment_products.tpl is same to as of VIVAShop.



Seems like problem is something else. Kindly help on this.



NOTE: Do you think if I create basic/mail/templates/shipments/shipment_products.tpl path under design/themes/ will make this work?

[/quote]



Please attach the design/themes/VIVASHOP_THEME/mail/templates/shipments/shipment_products.tpl file here

Sorry for late response. Please find code of the below template file.

design/themes/VIVASHOP_THEME/mail/templates/shipments/shipment_products.tpl



```php

{include file=“common/letter_header.tpl”}


{__(“dear”)} {$order_info.firstname},



{__(“products_were_sent”)}



{(“order_id”)}: #{$order_info.order_id}


{(“shipping_method”)}
: {$shipment.shipping}


{(“shipment_date”)}: {$shipment.timestamp|date_format:“$settings.Appearance.date_format, $settings.Appearance.time_format”}


{if $shipment.carrier}

{include file=“common/carriers.tpl” carrier=$shipment.carrier tracking_number=$shipment.tracking_number}

{(“carrier”)}
: {$smarty.capture.carrier_name nofilter}


{/if}

{if $shipment.tracking_number}

{__(“tracking_number”)}

{if $smarty.capture.carrier_url}

{$shipment.tracking_number}

{else}

{$shipment.tracking_number}

{/if}





{/if}


[b]{__(“products”)}:


{foreach from=$shipment.items key="hash" item="amount"}
{if $amount > 0}
{$amount} x {$order_info.products.$hash.product}

{if $order_info.products.$hash.product_options}
{include file="common/options_info.tpl" product_options=$order_info.products.$hash.product_options}

{/if}


{/if}
{/foreach}

[/b]
[b]{if $shipment.comments}



{__("comments")}:
{$shipment.comments}
{/if}[/b]
[b]{include file="common/letter_footer.tpl"}
```[/b]

Hello,


[quote name='fleaffair' timestamp='1406575025' post='188364']

Sorry for late response. Please find code of the below template file.

design/themes/VIVASHOP_THEME/mail/templates/shipments/shipment_products.tpl

[/quote]



It looks like this file is unmodified.



If you did not clear the template cache after modifying the [color=#282828][font=arial, verdana, tahoma, sans-serif]carriers.tpl files, please try it.[/font][/color]

Please let us know what modifications are required in this file so that we can make those changes. Is there some specific template cache we have to clear. I am aware of normal cache clear which we perform from Admin panel.

[quote name='fleaffair' timestamp='1406616508' post='188392']

Please let us know what modifications are required in this file so that we can make those changes. Is there some specific template cache we have to clear. I am aware of normal cache clear which we perform from Admin panel.

[/quote]



[color=#282828][font=arial, verdana, tahoma, sans-serif]Yes, the file looks unmodified. [/font][/color]To clear the cache, please use the following URL:


http://mydomain.com/myadmin.php?cc&ctpl



where



mydomain.com - domain of your store

myadmin.php - your admin index script



Thanks

I tried clearing cache but nothing worked for me. Not sure what the issue is?

If you provide us with the temporary FTP access to PM, we can examine the issue.

Hi

[list]

[]Thanks to swimcommunications. I have created new carriers and tracking links. But I still have a small issue.

[
]For example, my new carrier name is ket, in the language I added carrier_ket KET.

[]When the vendor choose carrier, KET is displayed.

[
]But when the customer checks the order, _ket is displayed as shown below.

Shipping information



KET Singapore Local Delivery

Carrier: _ket (tracking #1408291111)

[]

Another example

[
]

Shipping information

[color=#535353]

KET Singapore Local Delivery[/color][color=#535353]

Carrier: _taqbin (tracking #134134)[/color]

[/list]



Anyone knows how to make this right? So _ket should be displayed as KET or ket at least…

Can someone tell me the right way to do it?


  1. DB



    INSERT INTO cscart_shipping_services (status, module, code, sp_file) VALUES ('A', '???', '', '');


  2. variable: ltpost and name: Lithuanian Post


  3. Cant understand apart from url what goes where?


{elseif $carrier == "NEW_CARRIER"}
{$url = "http://YOUR_TRACKING_URL"}
{$carrier_name = __("NEW_CARRIER")}




Thank you




[quote name='swimcommunications' timestamp='1405391190' post='187533']

This was the response i got from cscart, which i assume they won't mind me reposting. Thought i'd post for others. Note this worked for me in cs-cart v 4.1.3.


  1. Create the new_carrier.sql file with the following content:

INSERT INTO cscart_shipping_services (`status`, `module`, `code`, `sp_file`) VALUES ('A', 'NEW_CARRIER', '', '');



where NEW_CARRIER should be replaced with your carrier name.



Restore this file in the Restore tab of the Administration > Database page in your admin panel.



2. Open the Administration > Languages > Translations page and create the carrier_NEW_CARRIER language variable where NEW_CARRIER is your new carrier name. Enter your carrier name in the Value field of this variable.



3. Open the design/themes/[YOUR_ACTIVE_THEME]/templates/common/carriers.tpl file of your CS-Cart installation and add this part of code:

{elseif $carrier == "NEW_CARRIER"}
{$url = "http://YOUR_TRACKING_URL"}
{$carrier_name = __("NEW_CARRIER")}




below this one:

{elseif $carrier == "temando"}
{$url = "https://temando.com/education-centre/support/track-your-item?token=`$tracking_number`"}
{$carrier_name = __("temando")}




where NEW_CARRIER should be replaced with your carrier name and YOUR_TRACKING_URL with the URL provided by your shipping carrier to track orders. Save the file.



Add the same part of code to the design/themes/[YOUR_ACTIVE_THEME]/mail/templates/common/carriers.tpl file of your CS-Cart installation. Save the file and check the results.

[/quote]

In your case it will be



INSERT INTO cscart_shipping_services (`status`, `module`, `code`, `sp_file`) VALUES ('A', 'ltpost', '', '');




and



{elseif $carrier == "ltpost"}
{$url = "http://www.post.lt/en/help/parcel-search/index?num=`$tracking_number`"}
{$carrier_name = __("ltpost")}




Hope this willl help

Well this has resulted in to having _carrier_ltpost as selection in creating new shippment page.



Here is how I have sorted this:


INSERT INTO cscart_shipping_services (`status`, `module`, `code`, `sp_file`) VALUES ('A', 'ltp', '', '');




Added lang:



variable ltp_post value Lithuanian Post

variable carrier_ltp value Lithuanian Post


{{elseif $carrier == "ltp"}
{$url = "http://www.domain.com/parcel-search/index?num=`$tracking_number`"}
{$carrier_name = __("ltp_post")}




PS this will solve mymart problem.

Darius, thank you for keeping us informed. Hope this information will be useful for many CS-Cart users

I tried to make similar amends but wanted to avoid having to modify carriers.tpl and instead use hooks or when necessary overrides.

Creating a hook for design/themes/[YOUR_ACTIVE_THEME]/templates/common/carriers.tpl simply would not work. whether .pre.tpl, .post.tpl or .override.tpl

This was apparently due to Smarty not being able to pass variables between hook template and parent template.

So instead I opted for creating full template override:

design/themes/[YOUR_ACTIVE_THEME]/templates/addons/my_changes/overrides/common/carriers.tpl



This worked first time and all is great.



However, I tried similar approach to mail templates and this simply refuses to work.

even when placing full override template in directory:

design/themes/[YOUR_ACTIVE_THEME]/mail/templates/addons/my_changes/overrides/common/carriers.tpl

the override of mail template is not registering nor working.

Is the directory structure for mail templates different to the front end templates?

Should I place mail override in different directory?



Any advice would be appreciated.

OK I solved it.



I actually went back to using the hook instead of override and found the way to pass back the variables $carrier_name and $url back to parent template.

the trick was in using scope=“root” in assign:



{assign var="carrier_name" value=$carrier_name scope="root"}
{assign var="url" value=$url scope="root"}




so if anybody prefers not to touch original templates the way to achieve this via hook is as follows:



for frontend, place file

design/themes/[YOUR_ACTIVE_THEME]/templates/addons/my_changes/hooks/carriers/list.post.tpl

for mail, place the file:

design/themes/[YOUR_ACTIVE_THEME]/mail/templates/addons/my_changes/hooks/carriers/list.post.tpl



change the citylink and ups to your courier codes and link to your tracking links



{if $carrier == "citylink"}
{$url = "http://www.city-link.co.uk/dynamic/track.php?parcel_ref_num=`$tracking_number`"}
{$carrier_name = __("carrier_citylink")}
{elseif $carrier == "ups"}
{$url = "http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_GB&InquiryNumber1=`$tracking_number`&AgreeToTermsAndConditions=yes&track.x=18&track.y=11"}
{$carrier_name = __("ups")}
{else}
{$url = ""}
{$carrier_name = $carrier}
{/if}

{assign var="carrier_name" value=$carrier_name scope="root"}
{assign var="url" value=$url scope="root"}




this still does not explain why override does not seem to work for mail templates… anyone knows?

Do the CSCart designers realise that there are other competitors that have Carrier customisation/functionallity straight out of the box??

No addon needed, no code changes. Some of them are free! FFS, c'mon cscart!

I have followed these steps (Database insert and the two Carriers.tpl), and I get the new carrier in the list. I am able to choose it.

The link in the email is not clickable.
Is there any easy fix for this?

CS-cart-team should really implement a FREE integrated module for this, Since this is a basic task ..
There is one carrier module, but it cost 45 euro ..