BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

Excel-export and package sizes #102

Closed jarinirv closed 1 year ago

jarinirv commented 1 year ago

In our national standard for technical trade there're 4 packages sizes, 1, 2, 3 & 4. Now most of our products are sold as single units therefore package size = 1. All package sizes also have 3 physical dimensions and weight. As an example I have product that is sold as single and physical dimensions and weight are only filled for package size 1. However, Excel-export results 0's for physical dimensions and weight for package sizes 2,3 and 4. Further on, this results export not being qualified later on the process of providing information to wholesalers. So is there a trick to remove those zeros from the output? Fields that are teasing me are 'Quantity Value'.

BlackbitDevs commented 1 year ago

Do you want to

?

jarinirv commented 1 year ago

Remove the zeros from physical dimensions and weight when nothing has been filled for those fields. If zeros exist then receiving side expects eg for package size 2 how many SKUs there are the box and we end up with an error. Later we probably move to REST API but for now this is the way :-)

jarinirv commented 1 year ago

Forgot to mention that I use 'Value' in Data Query Selector, eg 'packagesize3lenght:Value'.

BlackbitDevs commented 1 year ago

Easiest way would be to use the callback function for the corresponding virtual field in attribute mapping. Have you used the CSV export template for the result callback function? Then you should see a virtual field for every raw data field. Look for example for the field weight, click the angle braces ("settings") and add

if(!$params['value']) {
  return '';
}
return $params['value'];

Please see https://www.youtube.com/watch?v=1zFlAa6AXjE&list=PL4-QRNfdsdKIfzQIP-c9hRruXf0r48fjt&index=7&t=240s, there the steps of transforming export data is shown.

jarinirv commented 1 year ago

Integrator took care of this when I was absent.