Category Archives: Trick & Tips

How does Cumulative Price work in XShippingpro?

If you set final cost to Cumulative,  xshippingpro will sup up cost of all unit rows and even applicable Additional Price. Let look into following setting:

Before continue into further lets discuss two things.

How doesXshippingpro calculate Per Unit Cost?
If you noticed, I have entered Per Unit Block is 1 for the second unit row.  Since cost is defined $2 to that row. So each block cost would be $2. Lets calculate how may blocks out there.
Start: 10.1
End: 20
So Total blocks:  (End – Start) / Per Unit Block = (20 -10.1) / 1 = 9.9 i.e Round value: 10
( One thing is worth to inform that Xshippingpro would not round if you would have set Allow Partial is Yes )
Therefore, Total Cost: 10  x $2 = $20
How does Xshippingpro calculate Additional Price?
If xshippingpro find a match among the unit ranges, it will not move forward to Additional Price. But if there no proper matching is found, xshippingpro will move ahead to Additional Price rule and try to calculate shipping cost depending on its value.
By default, xshippingpro calculate additional cost per 1 Unit e.g 1 KG in this case (or whatever Rate Type you defined. If you define Rate type is Quantity, then Per 1 Item) basis unless you define Per Unit Block in the last unit row.
For example, there is no Per Unit Block  defined to the last unit range row. So additional price will be calculated for per 1 KG since Rate type is Weight. Lets say Additional Price is $10, that means cost for every KG is $10
If there was Per Unit block defined to the last unit range row, it would calculate additional price per Per Unit block basis. For example, if it was defined 2, additional price would calculate per 2 KG.  Lets say Additional Price is $10, that means cost for every 2KG is $10

Let’s proceed to main discussion. Lets say we have cart weight 60KG so what would the final shipping cost according to above setting?

1.  First row:  $5
2.  Second row:  $20      (No of blocks: 10 and Cost per block: $2 ,Therefore, 10 x $2 = $20 )
3.  Third row:  $20
Yes, we have still some weight 10KG pending to be calculated  even after all unit rows are done. Because our last row’s upper limit is 50KG but our cart weight is 60KG
4. Additional Shipping Cost: $50   ( Additional Price $5 and we have 10KG to be calculated per 1 KG basis)
Since Final Price cumulative so lets sum up item 1 to 4: ( $5 +$20 + $20 + $50) = $95
Therefore, Final shipping cost for 50KG weight would be $95

How to integrate Paypal standard in xpayment?

To integrate paypal standard in xpayment,  you will have to do following steps:

  1. Create a new payment method and provide a name
  2. You can enter Payment instruction if you wan to show to the customers
  3. In the General tab, change status to enable
  4. You can also apply any other rules like product or category if you need
  5. Now it is time to do real integration actions. In the Integration tab, we have to do followings:
  • Select Integration Type is Redirect/Forward to Payment URL
  • Enter URL to Redirect is https://www.paypal.com/cgi-bin/webscr
  • Select Method type is POST
  • Now enter following data into Data(s) field.

  • Enter following data into Additional Placeholders field. Please replace your_paypal@gmail.com by your Paypal email accordingly.

  • Select Return Type is POST
  • Enter Payment Success Condition is custom == {orderId}

That’s all.

How to remove twig cache in OC 3.x

There is a tiny developer menu in opencart 3.x that can be overlooked easily but it is very essential for every developer or store owner. All we know that since OC 3.x, it uses twig as template engine and we often need to remove twig cache. We can remove twig cache by removing files in storage/cache directory using ftp. Interesting that it is possible to remove template cache from developer menu that can be found admin dashboard easily. Here are the steps:

  1. First check you have enough permission to modify developer menu by editing User group.

2. Developer menu can be found in admin dashboard

3. It will open a popup whenever you click on developer menu. Now you can refresh/remove twig cache by clicking on Refresh icon. Also it is possible to remove SASS cache from that popup.

Shipping Cost per 100gm with additional $10

how to set following situation?

initial charge(Rate per parcel) $10
Plus rate per 100g or part thereof $1

So if customer buy an item of 300g
Total charge is $13 (1 x $10 + 3 x $1)

Thanks for your query. Please do following:

1. Under Price setting tab, Select Rate type is Weight.

I am assuming that your default weight unit is gram. If it is KG, then you will have to enter it accordingly. For example, 100 will be replaced with 0.1

Now enter following Unit Ranges:

Start . —- End . —- Cost —- per unit block —- Allow partial 
0 —- 999999 — 1 —– 100 – – — – – NO

Explanation:
——-
a. First define a big ranges 0 – 999999 so that it covers all weight
b. Per unit block ensure that it will charge $1 per 100 gram
c. Allow partial ensure that it will not charge partial block. SO it will charge $3 for 250 grams instead of $2.5

2. Under Price adjustment section, enter +10 into the field “Modifier” [+10 means it will add $10 with final cost]

how to overwrite default contact page by xform’s form?

You will have to follow following steps if you want to overwrite default contact form by form created by xform.

  1. Enable layout module option in Xform -> Integration.
  2.  Add following css rule Xform -> Other Tab into Custom CSS section. This is needed to hide default contact form.

3. Now navigate to Design -> Layout , Now edit Contact Layout. Finally add your form at Content bottom position.

That’s all.

 

How to install xshippingpro in OC 2.x?

Although I am giving screenshot of xshippingpro but these steps applicable for any module. So any module can be installed by following these steps.

First, unzip downloaded zip file.

You will get another zip file named get xshippingpro.ocmod.zip

 

Now, please Go to Admin -> Extensions -> Extension Installer.

Then select “xshippingpro.ocmod.zip” and click on continue.

Now please navigate to admin -> Extensions -> Shipping. Now click on Install button located beside X-shipping pro row.

Finally, go to Admin -> Extensions -> Modifications and now click on “Refresh” button

Congrats! You are done. Now it is ready for adding shipping method. New shipping method can be added from admin -> Extensions -> Shipping

Always display sub-categories in left side in opencart

By default sub-categories won’t be displayed until parent category become active. If you want to  keep sub-categories visible always, this hacks for you.

You need to modify two files.

Controller

catalog/controller/extension/module/category.php   [OC 2.3.x]
catalog/controller/module/category.php   [OC < 2.3 ]

Find following codes

Now replace above codes by following

 

View

catalog/controller/extension/module/category.tpl   [OC 2.3.x]
catalog/controller/module/category.tpl   [OC < 2.3 ]

You can replace all codes of template file by following

Good luck!

Moving Currency Selection from header to footer in opencart

If you want to move Currency selection dropdown from header to footer, you will need to following two files:

  1. catalog/controller/common/footer.php  Please add following code

Now  $currency is available inside catalog/view/theme/YOUR_THEME/template/common/footer.tpl so you can place it whatever you want in footer.tpl file i.e you will have place following code

 

 

 

Showing Breadcrumb on Homepage in opencart

By default opencart does not show breadcrumb on home page in default theme.  If you want to show breadcrumb on home page, you will have to modify two files.

Controllercatalog/controller/common/home.php, Add following code of lines just before the line $data[‘column_left’] = $this->load->controller(‘common/column_left’);

View   catalog/view/theme/YOUR_THEME/template/common/home.tpl , add following lines of code after <div class=”container”> or as per your theme.

That’s all.  It is recommended to use OCmod for modifying file instead of modifying directly, otherwise it will be lost in future update.

Feeling lazy! NO worry, I attached an OCmod. You can install through opencart extension installer.  Finally, refresh your modifications list in Admin -> Extensions -> Modification

Click here to download breadcrumbonhome.ocmod.xml 

What is Multi-Categories Rule in xshippingpro?

Xshippingpro matches rule categories with cart categories one by one during checkout. So it never permit a category that are not listed under rule categories. But often one product could be assigned to more than categories.  To work properly, you should enter all categories of a product to the rule categories list although it is not comfortable to enter each category for a single products.

Multi-Categories Rule can help in this case. You don’t need to put every categories of a product to the rule category list. Instead you can select only one of them, and choose Multi-Categories Rule to “Any” that will do affect same thing as entering all categories to rule category list.

multi-category

For example, you have a product which was assigned to category A, Category B and Category C. By default, you will have to select category A, Category B and Category C under xshippingpro category rule. But if you choose Multi-Categories Rule to “Any“, then it is enough to choose category A only under xshippingpro category rule to work properly. It will be same thing as choosing category A, Category B and Category C.

Multi-Categories Rule will help to save your time a bit.