Customising Product Data on Prestashop
Platforms:
In Prestashop, you can add most simple attributes directly from the Admin, but you can also create customised attributes directly in the code.
Sending simple attributes from the Prestashop Admin
Note: This feature only works from v.5.3.2. Check this guide to see how to upgrade.
In the Prestashop Admin, start by going to the following section:
Prestashop 1.7: Catalog -> Attributes & Features Prestashop 1.6 : Catalog -> Product Attributes
Here you can see all the attributes you have available:
Find the names of the attributes you want to add.
Then go to Modules And Services -> Clerk -> Configure.
Under Data Sync Settings, type in the attribute Names separated by comma in Additional Fields for Products. You can also turn on the fields such as Include Product Features in order to import all the products features to clerk. Both of these are available on both version 1.6 and 1.7 of Prestashop:
After implementing your attributes, go to my.clerk.io->Data and click Start New Data Sync in the upper right corner.
If the attributes you want to send are already available as part of your configurable/grouped products data in your PrestaShop admin, they can easily be synced on the latest version of your plug-in. They will appear as child_attribute, for example, child_color, child_skus etc.
Sending custom attributes
Custom attributes, that are more advanced, can be added through the module files in FTP.
This file handles the product-attributes:
modules->clerk->controllers->front->product.php
Each attribute has its own fieldHandler , which is used to pull it, in the function __construct
Simply add your attribute here, with the following syntax:
$this->addFieldHandler('CLERK_ATTRIBUTE_NAME',function($product){
return PRESTASHOP_LOGIC;
});
Where CLERK_ATTRIBUTE_NAME defines the name you want it to have in Clerk.io and PRESTASHOP_LOGIC is the code for pulling the attribute from Prestashop.
Lastly, include your new attributes in the function getDefaultFields() in the bottom of the file.