Difference between revisions of "Opencart duplicate module example"

From Wiki at Neela Nurseries
Jump to: navigation, search
m (Example Of Additional Flat Rate Shipping Modules)
m (Locating Existing OC Module Files)
Line 57: Line 57:
 
</pre>
 
</pre>
  
 +
Adding a comment block top of newly duplicated and modified files:
 +
 +
<pre>
 +
// <!--
 +
// 2018-07-01 - file duplicated from ./handling.tpl and modified by Ted,
 +
// to support phytosanitation fee.  Duplicating Opencart modules in this manner
 +
// explained at https://forum.opencart.com/viewtopic.php?t=6696
 +
//
 +
// Replacing 'Handling' and 'handling' with '[Pp]hytosanitation' . . .
 +
// -->
 +
 +
</pre>
  
  

Revision as of 13:21, 1 July 2018


2018-07-01 Sunday: how to duplicate handling fee module in Opencart


Overview

Want to add a fee similar to Opencart's default handling fee for ship-able orders. Free but technical way to do this is to duplicate files which implement the handling fee, making changes in them so they appear as a new Opencart module in Opencart's Extensions -> Order Totals admin page.


Example Of Additional Flat Rate Shipping Modules

$ find . -name '*flat*'
./admin/view/template/extension/shipping/flat_rate_to_europe.tpl
./admin/view/template/extension/shipping/flat.tpl
./admin/view/template/extension/shipping/flat_rate_to_canada.tpl

./admin/language/en-gb/extension/shipping/flat_rate_to_europe.php
./admin/language/en-gb/extension/shipping/flat_rate_to_canada.php
./admin/language/en-gb/extension/shipping/flat.php

./admin/controller/extension/shipping/flat_rate_to_europe.php
./admin/controller/extension/shipping/flat_rate_to_canada.php
./admin/controller/extension/shipping/flat.php

./catalog/model/extension/shipping/flat_rate_to_europe.php
./catalog/model/extension/shipping/flat_rate_to_canada.php
./catalog/model/extension/shipping/flat.php

./catalog/language/en-gb/extension/shipping/flat_rate_to_europe.php
./catalog/language/en-gb/extension/shipping/flat_rate_to_canada.php
./catalog/language/en-gb/extension/shipping/flat.php

$


Locating Existing OC Module Files

Searching for handling fee related files in Opencart 2.3.0.2 root directory:

$ find . -name '*hand*'
./admin/view/template/extension/total/handling.tpl
./admin/language/en-gb/extension/total/handling.php
./admin/controller/extension/total/handling.php
./catalog/model/extension/total/handling.php
./catalog/language/en-gb/extension/total/handling.php

$

Adding a comment block top of newly duplicated and modified files:

// <!--
// 2018-07-01 - file duplicated from ./handling.tpl and modified by Ted,
// to support phytosanitation fee.  Duplicating Opencart modules in this manner
// explained at https://forum.opencart.com/viewtopic.php?t=6696
//
// Replacing 'Handling' and 'handling' with '[Pp]hytosanitation' . . .
// -->