- Posts: 4
- Thank you received: 0
how to add a value to a custom column
15 years 9 months ago #5369
by ribeiro
how to add a value to a custom column was created by ribeiro
hi and thank you for your great shop
i created a payment type on my country and when the payment is done, i want to add a custom reference value to a custom column i created inside the jos_hikashop_order table.
The value is "referencia". this value is for payments done in ATM in my country wich are very popular (in Portugal)
so i created the "multibanco" payment option and it works, it generates the reference to wich people have to pay, and also sends an e-mail to our clients with that reference but i need to add this value to the database to keep track of things in the future.
on my multibanco.php i added:
but this does not work. i dont konw what is wrong with it
thanks in advance
i created a payment type on my country and when the payment is done, i want to add a custom reference value to a custom column i created inside the jos_hikashop_order table.
The value is "referencia". this value is for payments done in ATM in my country wich are very popular (in Portugal)
so i created the "multibanco" payment option and it works, it generates the reference to wich people have to pay, and also sends an e-mail to our clients with that reference but i need to add this value to the database to keep track of things in the future.
on my multibanco.php i added:
Code:
$db =& JFactory::getDBO();
$query = 'UPDATE '.hikashop::table('order').' SET referencia ='.$referencia2.' WHERE order_id ='.$order->order_id'';
$db->setQuery($query);
$result = $db->query();
but this does not work. i dont konw what is wrong with it
thanks in advance
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5372
by nicolas
Replied by nicolas on topic Re: how to add a value to a custom column
$referencia2 needs to be quoted and you have two quotes at the end which is not correct. It should be:
Code:
$query = 'UPDATE '.hikashop::table('order').' SET referencia ='.$db->Quote($referencia2).' WHERE order_id ='.(int)$order->order_id;
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5373
by ribeiro
Replied by ribeiro on topic Re: how to add a value to a custom column
hi mate thank you for your fast reply i tested and it still does not work.
it's like this:
i dont know if my file multibanco.php on the payment plugins should include some kind of joomla file.
im using joomla 1.5.22
at least i have phpmyadmin opened and i refresh the databse and i see the new product on the order tables but the "referencia" field is still empty.
also "referencia" is set as text to avoid problems once we just need it to check manually and know wich person bought what and when, and also to put it on the invoice on the details field.
it's like this:
Code:
$db =& JFactory::getDBO();
$query = 'UPDATE '.hikashop::table('order').' SET referencia ='.$db->Quote($referencia2).' WHERE order_id ='.(int)$order->order_id;
$db->setQuery($query);
$result = $db->query();
i dont know if my file multibanco.php on the payment plugins should include some kind of joomla file.
im using joomla 1.5.22
at least i have phpmyadmin opened and i refresh the databse and i see the new product on the order tables but the "referencia" field is still empty.
also "referencia" is set as text to avoid problems once we just need it to check manually and know wich person bought what and when, and also to put it on the invoice on the details field.
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5374
by nicolas
Replied by nicolas on topic Re: how to add a value to a custom column
Are you sure that you have the order_id in the $order object ? In which function of your plugin are you doing that query ?
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5382
by ribeiro
Replied by ribeiro on topic Re: how to add a value to a custom column
hi mate here is the code:
pastebin.com/9UhBgTf6
it will work for 24 hours
you can see the full multibanco payment system.
please dont laught at the "mess" of my code, at least part of it works
thanks
pastebin.com/9UhBgTf6
it will work for 24 hours
you can see the full multibanco payment system.
please dont laught at the "mess" of my code, at least part of it works
thanks
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5384
by nicolas
Replied by nicolas on topic Re: how to add a value to a custom column
In your function onAfterOrderConfirm, you don't set the variable $referencia2 and directly use it in the query, so it's normal that you get an empty value in the field in the database.
Please Log in or Create an account to join the conversation.
15 years 9 months ago #5387
by ribeiro
Replied by ribeiro on topic Re: how to add a value to a custom column
hi, thank you very much, i also set that variable as global so i dont have more problems. it's only used on the payment action and only if the payment is ATM so i will not touch it again soon.
once again thank you very much
once again thank you very much
Please Log in or Create an account to join the conversation.
11 years 5 months ago #203885
by nunonog
Replied by nunonog on topic how to add a value to a custom column
Hello,
I have a similar situation: we need the same system: "Multibanco" references sent to the customer. This is a very popular payment system here in Portugal.
Can anyone share any code to be used as a reference so that I can create a custom payment in Hikashop?
Thank you for any help!
I have a similar situation: we need the same system: "Multibanco" references sent to the customer. This is a very popular payment system here in Portugal.
Can anyone share any code to be used as a reference so that I can create a custom payment in Hikashop?
Thank you for any help!
Please Log in or Create an account to join the conversation.
11 years 5 months ago #203890
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic how to add a value to a custom column
Hi,
www.hikashop.com/support/support/documen...r-documentation.html
github.com/HikaShop/sample-payment-plugin
Regards,
www.hikashop.com/support/support/documen...r-documentation.html
github.com/HikaShop/sample-payment-plugin
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Time to create page: 0.062 seconds