Magento 2 Product Sync Special Functions

Below you will find a reference of the special functions available for our latest release of the Acctivate/Magento 2 product sync.

Please reach out if you have problems implementing this, as your version may vary.

Magento 2 Special Functions for Product Sync

  • @new_only
    • Only updates this field if it is for a new product (ie product we are inserting into Magento)
  • @setDefaultWeight(‘weight’)
    • Sets the weight to this value if there is no weight (this is important because normally weight is a required value in Magento.
  • @skip_if_blank
    • If the value for this field in Acctivate is empty, skip updating it.
  • @add_days(number_of_day)
    • Takes a date in an Acctivate field and formats it in the Magento required format
  • @date(‘mm/dd/yyyy’)
    • Takes a date in Acctivate and formats it in the format passed as a parameter. NOTE: valid formats are according to the PHP date_format function. Ask for help or check this reference doc: https://www.w3schools.com/php/func_date_date_format.asp
  • @withlinebreaks
    • Indicates the field is a text area in Acctivate and we need to replace them with html line breaks
  • @split(“,”,1)
    • Splits a field into values using the first parameter (ie the delimiter) and updates Magento with the nth value as passed in the second parameter. NOTE: Parameters begin with 0. So to return banana from “apple,banana,orange” the function should be @split(“,”,1)
  • @multi_select(“_orgitem:Organic”,”_hanging:Hangable”,”_SPCLORDER:Special Order”)
    • To set multiple True/False Acctivate fields into values to a muti Select Magento attribute. Each parameter indicates the Acctivate field name, followed by a colon (:), followed by the admin label of the MultiSelect option to select. For example, the special function listed here would ‘select’ the Organic option of my mapped attribute if the field _orgitem is true (or checked or value 1), Hangable option if the field _hanging is true, and Special Order option if the field _SPCLORDER is true
  • @pounds2ounces
    • Divides the value by 16 (the function name here is misleading)
  • @replace(‘find’,’replace’)
    • Finds and replaces a value in the Acctivate data with a different value. For example, if I want to replace all slashes / with an underscore _ I would use @replace(“/”,”_”)
  • @set_category(“parent”,”delimiter”,”is_full_path”,”create”,”root”,”cat_name_prefix”)
    • Add the product to a category based on the value of this field in Acctivate.
    • Parameters:
      • parent: the parent category
      • delimiter: the character that will separate multiple categories in the field
      • is_full_path: indicates if the sync should match the entire category path or only the actual ‘child’ category name (you can also pass the parent categories in ‘parent’ if matching full path)
      • create: indicates if we should create the category under the parent category if not already there (be very careful with this!)
      • root: is the root category name for your structure (ie default)
        cat_name_prefix: text to add to the Acctivate value to ‘build’ the category name