Skip to main content

Display text depending on shipping method

More
10 years 6 months ago - 10 years 6 months ago #234642 by kyratn
Hi,

I need to show text in email order status notification depending on shipping method and order status. Is this possible? What code I could use?

I use this code below to display text depending of the order status.
Code:
<?php if($data->order_status == 'shipped'){ ?><?php echo JText::_( 'CUSTOM_SHIPPING_MESSAGE_END' ); }?>
Regards
Last edit: 10 years 6 months ago by kyratn.

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

More
10 years 6 months ago #234673 by nicolas
Hi,

You can use such code:
Code:
if($data->order_status == 'shipped' && $data->cart->order_shipping_id==XXX){ //my code }
where XXX is the id of the shipping method for which you want to display something.
The following user(s) said Thank You: kyratn

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

More
10 years 6 months ago #234738 by kyratn
Thank you Nicolas

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

More
10 years 5 months ago - 10 years 5 months ago #237094 by kyratn
Hi,

This is the code i use to display text in order/listing view depending on order status.
Code:
<?php $url = JText::_( 'CUSTOM_POST_HYPERLINK' ); $url2 = JText::_( 'ORDER_TRACKING_AWAITING_PAYMENT' ); $url3 = JText::_( 'ORDER_TRACKING_AWAITING_SHIPMENT' ); $url4 = JText::_( 'NO_ORDER_TRACKING_NUMBER' ); if($row->order_status == 'shipped'){ echo '<a href="'.$url. $row->siuntosnumeris.'" target="_blank">'. $row->siuntosnumeris. '</a>'; }elseif ($row->order_status == 'created'){ echo '<span class="hikashop_order_listing_status hikashop_order_status_created">'.$url2.'</span>'; }elseif ($row->order_status == 'confirmed'){ echo '<span class="hikashop_order_listing_status hikashop_order_status_confirmed">'.$url3.'</span>'; }elseif ($row->order_status == 'refunded'){ echo '<span class="hikashop_order_listing_status hikashop_order_status_refunded">'.$url4.'</span>'; }elseif ($row->order_status == 'cancelled'){ echo '<span class="hikashop_order_listing_status hikashop_order_status_cancelled">'.$url4.'</span>'; }else{ echo JText::_( 'NO_ORDER_TRACKING_NUMBER' ); } ?>

Now, how can i display text depending on order status + payment method or shipping method?

Tried something like this:
Code:
}elseif ($row->order_status == 'created' && $row->order_payment_id== 8){ echo '<span class="hikashop_order_listing_status hikashop_order_status_created">'.$url3.'</span>';

Or this:
Code:
}elseif ($row->order_status == 'created' && $data->cart->order_shipping_id==XXX){ echo '<span class="hikashop_order_listing_status hikashop_order_status_created">'.$url3.'</span>';

But none worked.

Maybe because i do change payment method manually in back-end? Just to see if it works....

Also, where i could find payment or shipping id's? I only could see it with firebug...

Regards
Last edit: 10 years 5 months ago by kyratn.

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

More
10 years 5 months ago #237102 by nicolas
Hi,

It should be that:
Code:
}elseif ($data->cart->order_status == 'created' && $data->cart->order_shipping_id==XXX){

You can see the id of a payment/shipping method at the end of the URL in the address bar when you edit it in the backend.

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

More
10 years 5 months ago - 10 years 5 months ago #237340 by kyratn
Hi,

Are you sure this is correct code?
I tried to add this:
Code:
}elseif ($data->cart->order_status == 'created' && $data->cart->order_shipping_id==17){ echo '<span class="hikashop_order_listing_status hikashop_order_status_confirmed">'.$url3.'</span>';

And it didn't work.
So just to check I have changed in my code above from this:
Code:
$row->order_status == 'created'

to this:
Code:
$data->cart->order_status == 'created'

and it doesn't work anymore...

It seems $row is working but not $data
What is the difference?

I am trying to display text in order listing view file....

Thank you
Last edit: 10 years 5 months ago by kyratn.

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

More
10 years 5 months ago #237352 by nicolas
Hi,

I thought that you were in the order notification email.
On the order listing, then yes it's $row->order_status and $row->order_shipping_id
Just do a var_dump() of $row and you can see all the available variables for it.
The following user(s) said Thank You: kyratn

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

More
10 years 5 months ago #237446 by kyratn
Now it works.

Thank you

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

More
10 years 5 months ago - 4 years 10 months ago #237550 by kyratn
Nicolas can you help me once more please?

I am trying to add text in email notification. first text depending on status and second text depending on status + payment method
but it seems elseif isn't working for me and I am not sure why and what I am doing wrong.
Here is the code:
Code:
<?php if($data->cart->order_status == 'shipped' && $data->cart->order_payment_id==18){ echo JText::_( 'CUSTOM_SHIPPING_MESSAGE'); }elseif ($data->cart->order_status == 'shipped'){ echo JText::_( 'CUSTOM_SHIPPING_MESSAGE_CASH' ); } ?>

As I have 4 payment methods I need display other text for orders with one of these payment methods

Thank you
Last edit: 4 years 10 months ago by nicolas. Reason: fixed code

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

More
10 years 5 months ago #237553 by nicolas
Hi,

On the elseif you're using $data->order_status instead of $data->cart->order_status
That's all I can see in your code.

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

More
10 years 5 months ago #237668 by kyratn
Ahh, my bad. Seems i am blind...

Thank you Nicolas

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

Time to create page: 0.287 seconds
Powered by Kunena Forum