Thank you for your purchase on a new order

  • Posts: 15
  • Thank you received: 0
11 years 2 weeks ago #156834

-- url of the page with the problem -- : regalodifiorisumisura.it
-- HikaShop version -- : HikaShop Starter 2.2.3
-- Joomla version -- : 2.5.17
-- PHP version -- : 5.3.25
-- Browser(s) name and version -- : Firefox 15.0.1
-- Error-message(debug-mod must be tuned on) -- : none

I report an error.
I've modified checkin of login in order to use a guest user. I've selected paypal plugin as payment method.
When I complete the process and I am directed to paypal test account, the order is created well and the cart is resetted in the right way. The problem is that if I return to home page from paypal and I try to create a new order, then, when I want to pay, the website don't direct me to paypal account and reports this message:
Thank you for your purchase.
The new order isn't saved.
What could be the problem?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 weeks ago #156883

Hi,

Since the 2.2.3 there was some modifications and improvements, thanks to download the latest version (2.3.1) from our website, install it over your current version and try again. :)

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

  • Posts: 15
  • Thank you received: 0
11 years 2 weeks ago #156943

:pinch: Now I've heavily modified this component in order to fullfill needings of the project.
Please can you focus my efforts on the specific part of code that could cause this problem?
I'm on ending of my project and I cannot restart now the modifications.
Thanks, please help me.

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

  • Posts: 15
  • Thank you received: 0
11 years 2 weeks ago #157025

It happens after I saved the order and I'm redirected to paypal.
I think that the problem is in before_end() function in checkout.php controller. this is the code:
function before_end(){ $app = JFactory::getApplication(); $order = $app->getUserState( HIKASHOP_COMPONENT.'.order_id',0); if(empty($order)){ return $this->after_confirm(true); } return true; } When I return the $order the $order is not empty, so after_confirm() is not executed. So the data of the order are not updated. This cause end step to write echo JText::_('THANK_YOU_FOR_PURCHASE'); I need to do a new order every time I open a page (with browser back button or with browser address). What do you suggest to do? Do I need to empty $order or I need to call after_confirm, even if the order exists, or what else? Please help me.[code]
function before_end(){
$app = JFactory::getApplication();
$order = $app->getUserState( HIKASHOP_COMPONENT.'.order_id',0);
if(empty($order)){
return $this->after_confirm(true);
}
return true;
}
When I return the $order the $order is not empty, so after_confirm() is not executed. So the data of the order are not updated.
This cause end step to write
echo JText::_('THANK_YOU_FOR_PURCHASE');
I need to do a new order every time I open a page (with browser back button or with browser address).
What do you suggest to do?
Do I need to empty $order or I need to call after_confirm, even if the order exists, or what else?
Please help me.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 weeks ago #156952

Hmmm it will be difficult for us as we don't have this issue, there was 2 versions since the 2.2.3 and you made many modifications.
That problem can potentially come from your modifications, and this way we can't really help you.

You should check what's happening in the classes "order", "cart". Don't you have any plugins which could alter the comportment ?

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

  • Posts: 15
  • Thank you received: 0
11 years 2 weeks ago #157050

Xavier,
I didn't change the end() function in checkout.php controller.
The only plugins I use are SEF and SEO joomla core.
If I clean the browser cache and I restart to buy products, the problem disappear. So could be a variable saved client-side to cause the problem. Please, can you check the hidden fields of my forms in the normal flow of 2.2.3 version?
How can I empty order after saving it? I need to set $app->setUserState?
Thanks for the support.

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

  • Posts: 15
  • Thank you received: 0
11 years 2 weeks ago #157124

Ok, with only this modification:
function before_end(){
$app = JFactory::getApplication();
$order = $app->getUserState( HIKASHOP_COMPONENT.'.order_id',0);
//if(empty($order)){
return $this->after_confirm(true);
//}
//return true;
}
The user is redirected to product listing view with empty cart message. Then, choosing again the product and redoing the checkout steps, another order is created. Now, as before the modifications, I have the warning in the attached image.
It's caused by $order->customer->email. Customer is null in order class, save method. This could not be a problem.
I need also to add custom fields to invoice. Does a configuration support exist or Do I need to change the code of the component?

Attachments:
Last edit: 11 years 2 weeks ago by fafabone.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 week ago #157317

Hi,

Could you give us the corresponding line of the error ?

To add custom fields no invoice, you have to create them via the menu Display > Custom fields, and create them in the table "order" and thanks to some php, display it or not depending if it's an order or an invoice.

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

  • Posts: 15
  • Thank you received: 0
11 years 1 week ago #157328

Good Morning.
If you mean the problem reported in the attached image, it's not an error: it's a warning. Line 358 of order.php as the image reports, in HikaShop Starter 2.2.3 version.
It's caused by an evaluation of a null object: customer. This happen when you try to write customer email on order class, in the save method.

I can add custom fields on invoice, I do it, but how can I choose which field insert on invoice and which not?

Last edit: 11 years 1 week ago by fafabone.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 week ago #157375

Hi,

Could you give us the corresponding line of the error warning ?

The full line could help us.

In the view "order / invoice" in the backend, you have to add a php check on the $fieldName in the foreach of the code:
			$fieldsClass = hikashop_get('class.field');
			$fields = $fieldsClass->getFields('backend',$this->order,'order');
			if(!empty($fields)){ ?>
		<tr>
			<td>
				<fieldset class="hikashop_order_custom_fields_fieldset">
					<legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend>
					<table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%">
						<?php foreach($fields as $fieldName => $oneExtraField) {
						?>
							<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
								<td class="key">
									<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
								</td>
								<td>
									<?php echo $this->fieldsClass->show($oneExtraField,@$this->order->$fieldName); ?>
								</td>
							</tr>
						<?php
					}?>
					</table>
				</fieldset>
			</td>
		</tr>
				<?php
			}
For the view "order / show" in the frontend it's in the code:
						<?php foreach($this->fields['order'] as $fieldName => $oneExtraField) {
							if(!@$oneExtraField->field_frontcomp || empty($this->order->$fieldName)) continue;
						?>
							<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
								<td class="key">
									<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
								</td>
								<td>
									<?php echo $this->fieldsClass->show($oneExtraField,$this->order->$fieldName); ?>
								</td>
							</tr>
						<?php }	?>

It require PHP knowledge.

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

Time to create page: 0.102 seconds
Powered by Kunena Forum