Hi @bredaportoni
According to your screenshot the data is stored inside a multi-level array in the database. My suggestion would be to import the length options inside your own custom field, e.g. “my_custom_length”, then write custom code that uses our pmxi_saved_post hook to move that data into the array from your screenshot: http://www.wpallimport.com/documentation/advanced/action-reference/.
If you’d like us to confirm how the data is stored, then please set up the plugin on a demo site at http://wpallimport.com/debug and open a ticket at http://www.wpallimport.com/support/ with a link to this thread for reference.
Hi @bredaportoni
The price calculator plugin stores all values of specific product measurements in a multi-dimensional array in the database. I am not sure what will be the correct way but what if we use PHP to replace such values from the database? I’ve prepared a PHP snippet that works and can be handy for you. Put the below code into the Function editor
function map_length_values($data) {
$value = unserialize($data);
array_walk_recursive($value, 'replace_values');
return serialize( $value );
}
// Replace the values
function replace_values(&$element, $index) {
// Original values that you want to replace
$original_values = [10,20];
// The new values that you want to have instead
$new_values = [100, 200];
$element = str_replace($original_values, $new_values, $element);
}
Now update the $original_values and $new_values arrays as per your need.
Then pass the price calculate field value through the map_length_values function and it will be something like [map_length_values({_wc_price_calculator[1]})]
Screenshot: https://prnt.sc/s7obi4
Kind regards
-
This reply was modified 3 years, 12 months ago by Ohidul Islam.
Ok, we are near the solution… I hope!
My values are stored in the .csv that I import, In the “misuredisp” column:
screenshot: https://www.evernote.com/l/AAJyhaVG5wZKLYRZ8Y2RT3Pxg1RnVybVRQo
How must I change the function?
Replay to @wpallimport:
Here my Sandbox link: http://dull-ladybird.w5.wpsandbox.pro?upass=18IOb9q4jSRz
The “length” values are in the column “misuredisp”.
The template “Ita 2” are set to import my values… except for the lengths! 😀
Thanks in advance.
-
This reply was modified 3 years, 12 months ago by bredaportoni.
Hi @bredaportoni
Here my Sandbox link: http://dull-ladybird.w5.wpsandbox.pro?upass=18IOb9q4jSRz
I’ve had a look on the sandbox site and confirmed that the data is stored in a multi-dimensional serialized array, e.g.: https://d.pr/n/ZK9q4U. You can copy that data into https://www.unserialize.com/ to see what the array looks like.
How must I change the function?
Unfortunately, we can’t write the code required for this as part of our support.