- Posts: 57
- Thank you received: 1
Add fields from Payment Plugin to CSV Export
10 years 1 month ago #247119
by tariaki
Add fields from Payment Plugin to CSV Export was created by tariaki
-- HikaShop version -- : HikaShop Business: 2.6.3
-- Joomla version -- : 3.6
-- PHP version -- : 5.6
Hey
When using Purchase Order payment method there an input box for the order number. Also, I have added to it another inout box called The Workflow Code. I have managed to pass the values to the order, the confirmation emails and to the invoice but can't find how to add those 2 fields to the CSV Export file...
Ideas?
Thanks
-- Joomla version -- : 3.6
-- PHP version -- : 5.6
Hey
When using Purchase Order payment method there an input box for the order number. Also, I have added to it another inout box called The Workflow Code. I have managed to pass the values to the order, the confirmation emails and to the invoice but can't find how to add those 2 fields to the CSV Export file...
Ideas?
Thanks
Please Log in or Create an account to join the conversation.
10 years 1 month ago #247122
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Add fields from Payment Plugin to CSV Export
Hi,
The plugin "purchase order" store his data in the order history ; that data is not include in the order export.
With recent features in HikaShop, I think that the "order_payment_params" could be a better place to let that plugin store his data.
The idea would be to update the plugin and replace
By
And then you will also find the purchase order data in the order export (encapsulated but the information will be there).
Regards,
The plugin "purchase order" store his data in the order history ; that data is not include in the order export.
With recent features in HikaShop, I think that the "order_payment_params" could be a better place to let that plugin store his data.
The idea would be to update the plugin and replace
Code:
$history->data = JText::_('PURCHASE_ORDER_NUMBER').@$_SESSION['hikashop_purchase_order_number'];
Code:
$history->data = JText::_('PURCHASE_ORDER_NUMBER').@$_SESSION['hikashop_purchase_order_number'];
if(empty($order->order_payment_params))
$order->order_payment_params = new stdClass();
$order->order_payment_params->purchase_order = @$_SESSION['hikashop_purchase_order_number'];
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
10 years 1 month ago #247209
by tariaki
Replied by tariaki on topic Add fields from Payment Plugin to CSV Export
Hey Jerome
Thanks for your reply.
Added the changed in the code as you suggested :
Still can't find this info in the CSV file.
Ideas?
Cheers
Thanks for your reply.
Added the changed in the code as you suggested :
Code:
$history->data = JText::_('PURCHASE_ORDER_NUMBER').@$_SESSION['hikashop_purchase_order_number'];
if(empty($order->order_payment_params))
$order->order_payment_params = new stdClass();
$order->order_payment_params->purchase_order = @$_SESSION['hikashop_purchase_order_number']
."<br> The Work Flow Code : ".@$_SESSION['hikashop_account_holder_number'];
Still can't find this info in the CSV file.
Ideas?
Cheers
Please Log in or Create an account to join the conversation.
10 years 1 month ago #247214
by nicolas
Replied by nicolas on topic Add fields from Payment Plugin to CSV Export
Hi,
You'll only see that for new orders after you did the change. For older ones, there is no easy solution besides complex custom code.
Did you try after some new orders ?
Could you provide a copy of the resulting CSV ?
You'll only see that for new orders after you did the change. For older ones, there is no easy solution besides complex custom code.
Did you try after some new orders ?
Could you provide a copy of the resulting CSV ?
Please Log in or Create an account to join the conversation.
10 years 1 month ago - 10 years 1 month ago #247592
by tariaki
Replied by tariaki on topic Add fields from Payment Plugin to CSV Export
Hey Nicolas,
Almost there...
First, I have added a custom field to the plugin called 'The Workflow Code' - see attached.
I can see both fields on the order page in the backend and they are also being sent to the admin order creation email.
But in the report I can only see the order number field in a very strange format - see attached. And the custom field doesn't appear to be in the report at all.
My code looks like that :
And added your suggested code :
Ideas?
Thanks
Almost there...
First, I have added a custom field to the plugin called 'The Workflow Code' - see attached.
I can see both fields on the order page in the backend and they are also being sent to the admin order creation email.
But in the report I can only see the order number field in a very strange format - see attached. And the custom field doesn't appear to be in the report at all.
My code looks like that :
Code:
function needCC(&$method){
$method->custom_html='<span style="margin-left:10%">'.JText::_('PURCHASE_ORDER_NUMBER').
'<input type="text" class="hikashop_purchase_order_number inputbox required" name="hikashop_purchase_order_number" value="'.@$_SESSION['hikashop_purchase_order_number'].'"/> *</span><br /><br /><span style="margin-left:10%">'.
JText::_('The Workflow Code: ').'<input type="text" class="hikashop_account_holder_number inputbox required" name="hikashop_account_holder_number" value="'.@$_SESSION['hikashop_account_holder_number'].'"/> *</span>';
}
function onPaymentSave(&$cart, &$rates, &$payment_id) {
$_SESSION['hikashop_purchase_order_number'] = JRequest::getVar('hikashop_purchase_order_number');
$_SESSION['hikashop_account_holder_number'] = JRequest::getVar('hikashop_account_holder_number');
And added your suggested code :
Code:
$history->data = JText::_('PURCHASE_ORDER_NUMBER').@$_SESSION['hikashop_purchase_order_number'].
"<br> The Workflow Code : ".@$_SESSION['hikashop_account_holder_number'];
if(empty($order->order_payment_params))
$order->order_payment_params = new stdClass();
$order->order_payment_params->purchase_order = @$_SESSION['hikashop_purchase_order_number'];
Ideas?
Thanks
Last edit: 10 years 1 month ago by Jerome. Reason: cleaning code
Please Log in or Create an account to join the conversation.
10 years 1 month ago #247606
by nicolas
Replied by nicolas on topic Add fields from Payment Plugin to CSV Export
Hi,
As Jerome said, the information is
If you want it as its own column, then create a custom field of the table "order" via the menu Display>Custom fields and replace the line:
by:
where XXX is the column name of your custom field.
You'll then get your value is a separate column with its title being the column name of your custom field.
As Jerome said, the information is
in the report.encapsulated but the information will be there
If you want it as its own column, then create a custom field of the table "order" via the menu Display>Custom fields and replace the line:
Code:
$order->order_payment_params->purchase_order = @$_SESSION['hikashop_purchase_order_number'];
Code:
$order->XXX = @$_SESSION['hikashop_purchase_order_number'];
You'll then get your value is a separate column with its title being the column name of your custom field.
The following user(s) said Thank You: tariaki
Please Log in or Create an account to join the conversation.
Time to create page: 0.200 seconds