Customising Product Data on Magento 1
In Magento 1, you can add custom product attributes through the Magento backend, or through the Clerk.io extension in code, if needed.
Adding simple attributes
Note: This feature only works from v.4.2.3. Check this guide to see how to upgrade
If the attributes you want to send are already available as simple attributes in your Magento admin, they can easily be added on the Extension page.
1. In your Magento backend, start by going to Catalog -> Attributes -> Manage Attributes
2. Find the attribute codes of the attributes you want to add:
3. Go to System -> Configuration
4. Under Clerk -> Settings write in your attributes in Additional Fields and click Save Config:
5. 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 Magento 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.
Adding attributes through code
If your attribute uses a standard Magento function, this can be implemented directly in Product.php:
The function getClerkExportData() builds the product-object, with all the attributes:
You can then add new attributes in the list with this syntax:
where setAttributeName defines the name you want it to have in Clerk.io, and insertMagentoLogic(); uses a Magento logic to pull a value from the product.
Using custom attribute functions
Sometimes, a Magento attribute might require a more advanced logic, than a simple function. In this case, locate this file:
In Productbase.php you can write advanced PHP functions to load custom attributes.
After defining a function, you can include it in Product.php just like the existing functions.
After implementing your attributes, go to my.clerk.io->Data and click Start New Data Sync in the upper right corner.