- Posts: 10
- Thank you received: 0
Change the auto-generated product code when I copy
I have a product which I would like to duplicate and change the image and name, however when I do so the product code is auto generated is "Car_Decal_copy1359717116" Is there any way to change this so that the product code is generated as random numbers i.e "1359717116". Since this would look less of a mess in the long run. I'm sure it would just be a case of removing the PhP which generates the "Car_Decal_copy" part right? I just don't know where this would be located
Please Log in or Create an account to join the conversation.
$newProduct->product_code = $this->template->product_code.'_copy'.rand();
in the file administrator/components/com_hikashop/helpers/import.php
Please Log in or Create an account to join the conversation.
nicolas wrote: That's done with the line:
$newProduct->product_code = $this->template->product_code.'_copy'.rand();
in the file administrator/components/com_hikashop/helpers/import.php
Awesome that worked like a charm!
Please Log in or Create an account to join the conversation.
- Posts: 100
- Thank you received: 1
Could you tell me if it is possible to do an override on import.php. Using the developer information on your website for template overrides will it work for helper files:
/website/administrator/templates/isis/html/hikashop_import.php
Thanks
Patrick
Please Log in or Create an account to join the conversation.
For the import helper file which is located in administrator/components/com_hikashop/helpers/import.php you need to create a file in administrator/templates/isis/html/com_hikashop/administrator/helpers.import.php
You can copy the same code from the original file but you need to change the class name and add "Override" to it.
That way, in order to increase the backward compatibility, you can include the original file from the override file and have your Override class extend from the original class.
Please Log in or Create an account to join the conversation.
- Posts: 100
- Thank you received: 1
Firstly really appreciate your assistance.
I have created a file to /public_html/dev_j3/administrator/templates/isis/html/com_hikashop/administrator/helpers.import.php.
I have changed the class name from "hikashopImportHelper" to "roartestOverride" but it does not seem to take effect?
I have also tried class roartest extends hikashopImportHelper but this did not take effect as well.
Could you advise if the location is correct?
Thanks
Patrick
Please Log in or Create an account to join the conversation.
The name must be "hikashopImportHelperOverride".
Please Log in or Create an account to join the conversation.
- Posts: 100
- Thank you received: 1
I am currently using:
Hikashop Version: 2.3.1
Joomla: 3x
PHP: 5x
I changed the name to "hikashopImportHelperOverride" but it still no luck. Can't seem to get it to use the file under /public_html/dev_j3/administrator/templates/isis/html/com_hikashop/administrator/helpers.import.php
Thanks
Patrick
Please Log in or Create an account to join the conversation.
Are you sure that the override has been made in the correct template ?
Are you using isis as backend template ?
Please Log in or Create an account to join the conversation.
- Posts: 100
- Thank you received: 1
Please Log in or Create an account to join the conversation.
administrator/templates/isis/html/com_hikashop/administrator/helpers/import.override.php
Please Log in or Create an account to join the conversation.
- Posts: 100
- Thank you received: 1
Thanks very much for clearing that up.
The final location was as you mentioned
administrator/templates/isis/html/com_hikashop/administrator/helpers/import.override.php
The name of the class in the import.php file was hikashopImportHelper. As Xavier advised, I couldn't rename it but just had to
put Override. In the end the class name used in the override file was "hikashopImportHelperOverride".
Again really appreciate the assistance.
Regards
Patrick
Please Log in or Create an account to join the conversation.