You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Hi,
How do you include Unit price in the confirmation emails and displays, specifically in the ITEMS cell?
// +-- // | Print our item information cell. // +-- if ($ship_type != 'NOTSHIPPED') {print '<td class="regtable" style="width: 50%">' . $eol;} elseif ($ship_count == 0) {print '<td class="regtable" style="width: 100%">' . $eol;} else {print '<td class="regtable" style="width: 100%" colspan="2">' . $eol;} foreach ($ship_items as $key_num => $item_num) { foreach ($order['items'] as $num => $item) { if ($item_num == $item['id']) { // +-- // | Print the item name. // +-- if ($shownums) {$name = $item['itemname'] . ' - ' . $item['itemnum'];} else {$name = $item['itemname'];} $name = $this->xhtml_encode($name); $quan = $this->xhtml_encode($CORE_App->number_commify($item['itemquan'])); print '<p class="strong">' . $name . '</p>' . $eol; // +-- // | Print options. // +-- if (!(empty($item['cartdata']['optdisp']))) { $xodisp = ''; foreach ($item['cartdata']['optdisp'] as $oname => $ovalue) { if (!(empty($ovalue))) { $oname = $this->xhtml_encode($oname); $ovalue = $this->xhtml_encode($ovalue); $xodisp .= $oname . ': ' . $ovalue; if ($optlb) {$xodisp .= '<br />';} else {$xodisp .= '; ';} } // End of if statement. } // End of foreach statement. $xodisp = preg_replace('/\; $/','',$xodisp); $xodisp = preg_replace('/\<br \/\>$/','',$xodisp); if (!(empty($xodisp))) {print '<p>' . $xodisp . '</p>';} } elseif (!(empty($item['itemopts']))) { print '<p>' . $this->xhtml_encode($item['itemopts']) . '</p>'; } // End of if statement.
Cheers,
Bruce.
Last edited by west4 (02-19-2013 07:28:10)
Offline
I would add something like:
$unitprice = $item['ordertotal'] / $item['itemquan']; $unitprice = $this->include_namespace('core','getprice',array('amount' => $unitprice, 'entrycurr' => $currapp, 'returncurr' => $currshow, 'formatwsym' => 1, 'formatweutax' => 0)); $unitprice = $this->xhtml_encode($unitprice);
Don't use the last line (xhtml_encode) for the text email order summary.
Offline
Hi Nick,
Thanks That Worked....
here is my finished code for anyone that needs the unit price in checkout and confirmation emails...
(I stuck it in just after item name)...
..................... // +-- // | Print our item information cell. // +-- if ($ship_type != 'NOTSHIPPED') {print '<td class="regtable" style="width: 50%">' . $eol;} elseif ($ship_count == 0) {print '<td class="regtable" style="width: 100%">' . $eol;} else {print '<td class="regtable" style="width: 100%" colspan="2">' . $eol;} foreach ($ship_items as $key_num => $item_num) { foreach ($order['items'] as $num => $item) { if ($item_num == $item['id']) { // +-- // | Print the item name. // +-- if ($shownums) {$name = $item['itemname'] . ' - ' . $item['itemnum'];} else {$name = $item['itemname'];} $name = $this->xhtml_encode($name); $quan = $this->xhtml_encode($CORE_App->number_commify($item['itemquan'])); print '<p class="strong">' . $name . '</p>' . $eol; //+- // print unit price bruce //+- $unitprice = $item['ordertotal'] / $item['itemquan']; $unitprice = $this->include_namespace('core','getprice',array('amount' => $unitprice, 'entrycurr' => $currapp, 'returncurr' => $currshow, 'formatwsym' => 1, 'formatweutax' => 0)); $unitprice = $this->xhtml_encode($unitprice); print '<p class="strong">Unit Price: ' . $unitprice . '</p>' . $eol; //+- // end print unit price bruce //+- // +-- // | Print options. // +-- if (!(empty($item['cartdata']['optdisp']))) { $xodisp = ''; foreach ($item['cartdata']['optdisp'] as $oname => $ovalue) { if (!(empty($ovalue))) { $oname = $this->xhtml_encode($oname); $ovalue = $this->xhtml_encode($ovalue); $xodisp .= $oname . ': ' . $ovalue; if ($optlb) {$xodisp .= '<br />';} else {$xodisp .= '; ';} } // End of if statement. } // End of foreach statement. $xodisp = preg_replace('/\; $/','',$xodisp); $xodisp = preg_replace('/\<br \/\>$/','',$xodisp); if (!(empty($xodisp))) {print '<p>' . $xodisp . '</p>';} } elseif (!(empty($item['itemopts']))) { print '<p>' . $this->xhtml_encode($item['itemopts']) . '</p>'; } // End of if statement. // +-- // | Print ship status. // +-- .................
Cheers,
Bruce.
Last edited by west4 (02-20-2013 07:13:44)
Offline
How would one do the same except for the account review - view/print orders? And would this add it to the order export for Quickbooks? Really need to be able to have unit price displayed vs just the total price.
Offline
Hi,
It is in my Print View and my Order Summery Review displays too.
So you need to edit Location: System Dashboard > System > Displays > Display Includes -- Order Summary (Order Confirmation)
and
Location: System Dashboard > System > Displays > Display Includes -- Order Summary (Printable XHTML Invoice)
I also added it to Location: System Dashboard > System > Displays > Display Includes -- Order Summary (XHTML Mail) too.
and that should do it for the displays...
For Quickbooks you would have to add a 'unit price' field but I don't know how quickbooks export works, sorry...
Cheers,
Bruce.
Offline
Thanks, Bruce. I owe you a bottle in front of you
Offline
I'm stumped on where/how to put this in the Order Summary XHTML.
Last edited by sbhkma (09-12-2016 13:52:07)
Offline
Hi,
In the backend go to Location: System Dashboard > System > Displays > Display Includes and find 'Order Summary (XHTML Mail)' click UPDATE...
Then copy the code here...
//+- // print unit price bruce //+- $unitprice = $item['ordertotal'] / $item['itemquan']; $unitprice = $this->include_namespace('core','getprice',array('amount' => $unitprice, 'entrycurr' => $currapp, 'returncurr' => $currshow, 'formatwsym' => 1, 'formatweutax' => 0)); $unitprice = $this->xhtml_encode($unitprice); print '<p class="strong">Unit Price: ' . $unitprice . '</p>' . $eol; //+- // end print unit price bruce //+-
and paste it between here...
// +-- // | Print our item information cell. // +-- if ($ship_type != 'NOTSHIPPED') {print '<td class="regtable" style="width: 50%">' . $eol;} elseif ($ship_count == 0) {print '<td class="regtable" style="width: 100%">' . $eol;} else {print '<td class="regtable" style="width: 100%" colspan="2">' . $eol;} foreach ($ship_items as $key_num => $item_num) { foreach ($order['items'] as $num => $item) { if ($item_num == $item['id']) { // +-- // | Print the item name. // +-- if ($shownums) {$name = $item['itemname'] . ' - ' . $item['itemnum'];} else {$name = $item['itemname'];} $name = $this->xhtml_encode($name); $quan = $this->xhtml_encode($CORE_App->number_commify($item['itemquan'])); print '<p class="strong">' . $name . '</p>' . $eol;
and here
// +-- // | Print options. // +-- if (!(empty($item['cartdata']['optdisp']))) { $xodisp = ''; foreach ($item['cartdata']['optdisp'] as $oname => $ovalue) { if (!(empty($ovalue))) { $oname = $this->xhtml_encode($oname); $ovalue = $this->xhtml_encode($ovalue); $xodisp .= $oname . ': ' . $ovalue; if ($optlb) {$xodisp .= '<br />';} else {$xodisp .= '; ';} } // End of if statement.
hit the SUBMIT button and that should do it.
Cheers,
Bruce.
Last edited by west4 (09-13-2016 02:51:22)
Offline