alexinwp
Forum Replies Created
-
Your
$itemto$item['item']correction helped a lot. The diagnostic step was successful thanks to that.I’m glad I did something… 🙂
Thank you so much for your help and your time, it works perfectly now.
Take care.
So there’s no printed text when I do it, but a “Fatal error: Call to a member function get_meta() on array” on the HTML output.
I also tried
$ccb_calculator = $item['item']->get_meta( 'ccb_calculator', true, 'edit' );instead of$ccb_calculator = $item->get_meta( 'ccb_calculator', true, 'edit' );.It removes all the order details (items, quantities, prices and totals) on the settings preview mode. On the HTML output though, all the details are here, I also got a big mess of arrays, labels, values and calculations AND my details list correctly displayed as expected.
I’m not sure if it’s worth mentioning, but the big mess of data includes the first options in the
ccb_calculatorarray :product_id,item_nameandorder_id, before thecalc_dataarray which contains the interesting options. It starts like that :array(6) { ["product_id"]=> int(34) ["item_name"]=> string(0) "" ["order_id"]=> int(0) ["calc_data"]=> array(14) { ["quantity_field_id_0"]=> array(2) { ["label"]=> string(12) "Longueur (L)" ["value"]=> string(6) "630 mm" }No problem mate.
The first correction got me a parse error message. The second one does nothing.
Could this be because we’re not explicitly naming each option contained in
calc_datathat we want to display ?Hey Darren,
Sorry for the late reply, I’ve been busy with other things and haven’t had time to test it.
Thanks for the snippet and explanation. Unfortunately, it doesn’t work… Nothing else is displayed.
Hey Darren,
Thanks for your reply. It seemed odd to me too (that’s what Store Toolkit displays though), but it didn’t work without the brackets either.
Now it does “work” if I put
if (empty($item['item'])) return;instead ofif (empty($item['product'])) return;on the previous line.This way, it displays “Details: Array” below the product.
According to Store Toolkit, [ccb_calculator] is an array of four items, including [calc_data], which is an array storing each customization option for my products (with another array containing individual labels and values). This is structured as follows :
ccb_calculator
| calc_data
| quantity_field_id_0
| label
| value
| quantity_field_id_1
| label
| valueThis is the tricky part for me because I don’t really know PHP.
How can I display my customization options (label + value) within a “Details” list ?
Thank you in advance !