faysal f Posted August 16, 2022 Share Posted August 16, 2022 (edited) oreach ($order_details as $key_order => $val_order) { $info = new ApcarrentalOrder(); $info = $info->getOrderByIdProduct($val_order['id_order'], $val_order['product_id']); $info = $info[0]; $order_details[$key_order]['date_from'] = $info['date_from']; $order_details[$key_order]['date_to'] = $info['date_to']; $service = explode(',', $info['service']); if (!empty($service)) { foreach ($service as $key_s => $val_s) { $service[$key_s] = new ApcarrentalService($val_s, $id_lang); } } $order_details[$key_order]['service'] = $service; } $data = array( 'baseurl' => Context::getContext()->shop->getBaseURL(true, true), 'order' => $this->order, 'order_invoice' => $this->order_invoice, 'order_details' => $order_details, 'carrier' => $carrier, 'cart_rules' => $cart_rules, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, 'layout' => $layout, 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'footer' => $footer, 'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_, 'round_type' => $round_type, 'legal_free_text' => $legal_free_text, ); if (Tools::getValue('debug')) { die(Tools::jsonEncode($data)); } $this->smarty->assign($data); ========in tpl file I call variables date_from and date_to and dosen't work ============ {foreach $order_details as $key_order => $val_order} {cycle values=["color_line_even", "color_line_odd"] assign=bgcolor_class} <tr class="product {$bgcolor_class}"> <td class="product center"> {$key_order.val_order.date_from} </td> <td class="product center"> {$key_order.val_order.date_to} </td> </tr> {/foreach} ============= Edited August 16, 2022 by faysal f (see edit history) Link to comment Share on other sites More sharing options...
Ali Samie Posted August 17, 2022 Share Posted August 17, 2022 (edited) If I were you, I would check this: before this line: $this->smarty->assign($data); check if $order_details have correct data, check if there are date_from and date_to Then in your tpl use dump function and dump like this: {dump($order_details)} Check if this has the valid values you are looking for Edited August 17, 2022 by stifler97 (see edit history) Link to comment Share on other sites More sharing options...
faysal f Posted August 18, 2022 Author Share Posted August 18, 2022 On 8/17/2022 at 11:46 AM, stifler97 said: If I were you, I would check this: before this line: $this->smarty->assign($data); check if $order_details have correct data, check if there are date_from and date_to Then in your tpl use dump function and dump like this: {dump($order_details)} Check if this has the valid values you are looking for How can I check it ? Link to comment Share on other sites More sharing options...
Ali Samie Posted August 18, 2022 Share Posted August 18, 2022 You can use Prestashoplogger to log any data anywhere in the code. then check logs in BO to verify You can also use var_dump(), dump() or print_r() to get data in an array Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 25, 2022 Share Posted August 25, 2022 You can even use the "displayPDFInvoice()" hook for adding the pickup date and drop off date in the invoice. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now