Skip to main content

Cart page : add donation line

More
10 years 10 months ago #223351 by newt
Replied by newt on topic Cart page : add donation line
It doesn't work. ..
I put it in the beginning of the file and I have a error message when I confirm the command.

zupimages.net/viewer.php?id=15/50/yhg1.png

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago #223375 by nicolas
It says that you're using "my_data" and that there is no "my_data" custom field configured on your website.
Please make sure that you use the exact same name as you've set in the column name of your custom field.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #223903 by newt
Replied by newt on topic Cart page : add donation line
If I do this ?
Code:
$orderClass = hikashop_get('class.order'); $order = new stdClass(); $order->order_id = $data->order_id; $order->donation = $_SESSION['donation']; $orderClass->save($order);
Last edit: 10 years 9 months ago by nicolas. Reason: please use the code tags in your messages on the forum

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #223926 by nicolas
Yes, you can do that, if you have a custom order field with the column name "donation"

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224008 by newt
Replied by newt on topic Cart page : add donation line
the order field with the column name 'donation' is already set in the line 4 no ?

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224017 by nicolas
Yes.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #224129 by newt
Replied by newt on topic Cart page : add donation line
I don't understand..
It doesn't work.

If the column name 'donation' is set in the line 4 then this code should work no ?
Code:
$orderClass = hikashop_get('class.order'); $order = new stdClass(); $order->order_id = $data->order_id; $order->donation = $_SESSION['donation']; $orderClass->save($order);
Last edit: 10 years 9 months ago by nicolas.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224147 by nicolas
Hi,

So are you sure that you have something in
Code:
$_SESSION['donation']
where you have that code ?
Because the rest of the code is definitely correct.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224219 by newt
Replied by newt on topic Cart page : add donation line
Yes because I can display it.
It's the value that the client put in the donation input in the command page.

I made another test.

$order->donation = 42;

but I have the same error where the donation column is unknown...

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224223 by nicolas
So did you create a custom field of the table "order" and with the column name "donation" like I said before ?
Otherwise, you won't be able to save anything in it.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224336 by newt
Replied by newt on topic Cart page : add donation line
No i didn't.
I read again but I don't find how can I create it ?

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224347 by nicolas
Hi,

Go in the menu Display>Custom fields, click on the "new" button and select the "order" choice in the "table" setting.
Note that this is only available with the Business edition of HikaShop.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224476 by newt
Replied by newt on topic Cart page : add donation line
Thank you

To use it I just do for example

echo $order->donation;

?

I tried this in the order_status_notification file but it display nothing.
And to edit the total in the database I can use the previous code to modify it ?

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #224507 by nicolas
It should be:
<?php echo $order->cart->donation; ?>
in the HTML version of the email.

Normally, to have the total take it into account, you would have to develop a plugin like I said previously:
www.hikashop.com/forum/checkout/880481-c...ion-line.html#221354
Otherwise, it require code modifications a bit everywhere in order to take into account the donation.

Please Log in or Create an account to join the conversation.

Time to create page: 0.217 seconds
Powered by Kunena Forum