AbanteCart Community

AbanteCart Development => Extensions and Add-Ons => Topic started by: yujindeviant on May 10, 2017, 02:15:36 AM

Title: Cloning Flat Rate Shipping Extension (or any other extension)
Post by: yujindeviant on May 10, 2017, 02:15:36 AM
Hi, I have been trying to figure out on how to make duplicates of any Shipping Extensions. I want to clone flat rate extension. I need a step-by-step guide on how to achieve this. I'm not able to find any clear guides on how to create this. Please, I really need help! Thank you!
Title: Re: Cloning Flat Rate Shipping Extension
Post by: yujindeviant on May 10, 2017, 02:17:35 AM
Help me, I can donate for the effort.
Title: Re: Cloning Flat Rate Shipping Extension
Post by: abantecart on May 10, 2017, 01:23:54 PM
Here are the steps:

1. Inside of extensions directory copy folder default_flat_rate_shipping (including content) and rename to something else.
I will use new_extension_clone as a name
https://github.com/abantecart/abantecart-src/tree/master/public_html/extensions/default_flat_rate_shipping

2. Inside of new directory extensions/ew_extension_clone/ you need to locate all the files and folders that are named with default_flat_rate_shipping
For example:
https://github.com/abantecart/abantecart-src/tree/master/public_html/extensions/default_flat_rate_shipping/admin/language
https://github.com/abantecart/abantecart-src/tree/master/public_html/extensions/default_flat_rate_shipping/storefront/language
https://github.com/abantecart/abantecart-src/tree/master/public_html/extensions/default_flat_rate_shipping/storefront/model/extension

Use file search tool on your OS

Rename above files/folders to new_extension_clone. For files, important to keep same file extensions (.php).

3. Inside of new directory extensions/ew_extension_clone/ you need to locate usage of string default_flat_rate_shipping in the files and replace with new_extension_clone

4. In models and controllers, you need to change class names
https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_flat_rate_shipping/storefront/model/extension/default_flat_rate_shipping.php

From:
class ModelExtensionDefaultFlatRateShipping extends Model {
To:
class ModelExtensionNewExtensionClone extends Model {

5. See what you need to change in configuration file:
https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_flat_rate_shipping/config.xml

That is all.
Now you can go to admin and install new extension.
 

PS:
Feel free to help and add extension cloning functionality to Extension Dev tools.
https://github.com/abantecart/developer_tools_extension/tree/master/v1.3beta
Title: Re: Cloning Flat Rate Shipping Extension (or any other extension)
Post by: yujindeviant on May 10, 2017, 10:29:00 PM
Thank you, i will try the above steps. Thank you! Will let you know the outcome.
Title: Re: Cloning Flat Rate Shipping Extension (or any other extension)
Post by: yujindeviant on May 11, 2017, 09:18:34 AM
Thanks! Out of all the above, what i did wrong was i missed the class. I overlooked that part. Thanks again for the great assistance. How or where do i send some donates to? Get back to me!
Title: Re: Cloning Flat Rate Shipping Extension (or any other extension)
Post by: Basara on May 12, 2017, 01:24:43 AM
Thanks! Out of all the above, what i did wrong was i missed the class. I overlooked that part. Thanks again for the great assistance. How or where do i send some donates to? Get back to me!


http://www.abantecart.com/contribution
contribute and help us build even better open source ecommerce
Title: Re: Cloning Flat Rate Shipping Extension (or any other extension)
Post by: yujindeviant on May 12, 2017, 02:52:07 PM
Thanks again. Will donate some!