How to access Cart Value and Currency?

  • Posts: 87
  • Thank you received: 10
14 years 1 month ago #822

Hi,
how can I access on some active values of the cart module in a different view template?

Thx Gabor
H6

Last edit: 14 years 1 month ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 month ago #823

Hi,

I'm afraid I didn't understand what you want to do. Could you elaborate your question ?

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

  • Posts: 87
  • Thank you received: 10
14 years 1 month ago #824

You dont have a bed mh?

Okay - it is easy to explain. In the Display-View->Frontend Templates we have the cart. Now we need to add a trustedshop form for a costumer assurance. I put this form under the cart as a new template module. We need 4 simple values in that form. The user mail (by joomla $user->mail) and the final amount of the current order, the currency (Euro), the costumer number and the order number.

Is there a easy way to access to this value even when we change something in the cart?

Thx
Gabor
H6 Berlin

Last edit: 14 years 1 month ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 month ago #825

The biggest problem will be the order number. The order is created on the last time the user click on next. So there is no order number before that. And after that the user is redirected to the payment plateform. So I don't how you could get it. The rest of the data can be easily retrieved.

If you could tell me more in details what kind of form you want to add and why you need the order number, I might be able to find a work around.

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

  • Posts: 87
  • Thank you received: 10
14 years 1 month ago #826

okay here we go. Such a form is necessary for a trusted shop proof.

<table width=400 border="0" cellspacing="0" cellpadding="4"> 
<tr> 
<td width="90"> 
<form name="formSiegel" method="post" action= 
"https://www.trustedshops.com/shop/certificate.php" target="_blank"> 
<input type="image" border="0" src="pfad/zum/siegel.gif" title= 
""> 
<input name="shop_id" type="hidden" 
value="1234567890_trustedshop_id"> 
</form> 
</td> 
<td align="justify"> 
<form id="formTShops" name="formTShops" method="post" 
action="https://www.trustedshops.com/shop/protection.php" 
target="_blank"> 
<input type="hidden" name="_charset_" value=""> 
<input name="shop_id" type="hidden" 
value="1234567890_trustedshop_id"> 
<input name="email" type="hidden" value="[value email]"> 
<input name="amount" type="hidden" value="[value amount]"> 
<input name="curr" type="hidden" value="[value curr]"> 
<input name="payment" type="hidden" value="[value payment typ]"> 
<input name="KDNR" type="hidden" value="[value User ID]"> 
<input name="ORDERNR" type="hidden" value="[value Order ID]"> 
Als zus&auml;tzlichen Service bieten wir Ihnen den Trusted Shops 
K&auml;uferschutz an. Wir &uuml;bernehmen alle Kosten dieser Garantie, 
Sie m&uuml;ssen sich lediglich anmelden.<br><br> 
<input type="submit" id="btnProtect" name="btnProtect" 
value="Get the Trusted Shop Assurance"> 
</form> 
</td> 
</tr> 
</table> 

When the Order id is accessibly only after the purchase, then we realy have a problem. This Assurance is independed from the success of the purchase.

Cheer
Gabor
h6

Last edit: 14 years 1 month ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 month ago #827

So, I looked at the trustedshops thing on the internet and other shopping carts always add it at the end of the order, on the thank you page.
So, it will depend on the payment method you use.
If you use the "collect on delivery", the "bank transfer" or the "check" payment plugins you will want to edit the file end.php of the view checkout.
If you use the external payment plugins like paypal, you will want to display it when the user returns on your website and so you will want to edit the file after_end.php of the view checkout.

There you will have to load the order information like this:

$app =& JFactory::getApplication();
	$order_id = $app->getUserState( HIKASHOP_COMPONENT.'.order_id');
	$orderClass = hikashop::get('class.order');
	$order = $orderClass->loadFullOrder($order_id);
You will have all the information you need about the order in the $order variable.

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

  • Posts: 87
  • Thank you received: 10
14 years 1 month ago #828

ok....of course, it makes sense, to put this form on the "thankyou"-page. The supporter there told me something different.

Tomorrow I will talk to trusted shop and start the licensing process. With this form and some other easy stuff, Hikashop will get the trusted shop certification ! Chakka.

Thanks a lot Nicolas
Gabor
H6 Berlin

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3607

Hi Nicolas,

you still online...!.

For some reason, after the update the $order Array is empty or not accessable, when we are coming back from paypal. Did you have an idea?

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3608

That shouldn't be the case. You mean the order_id ?
Normally, the order_id should also be in the $_REQUEST object when returning from paypal.
You could use that as well instead of the getUserState function call :

$order_id =JRequest::getVar('order_id');

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3609

here is an request, thats comes back from paypal:

Array ( [option] => com_hikashop [ctrl] => checkout [task] => after_end [naildesign1_tpl] => naildesign1 [__utma] => 1.1268703613.1291335214.1292195363.1292460232.17 [__utmz] => 1.1291335214.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) [1ee73a388da0bb7ec3d7afe3beccac53] => 1c1e813bb9cc92039bf1110b67272380 [__utmc] => 1 [d4dad6935f632ac35975e3001dc7bbe8] => lftiq3gk9ahv3bq89146qtf1h0 [jfcookie] => Array ( [lang] => de ) [__utmb] => 1.5.10.1292460232 [Itemid] => [hikashop_front_end_main] => 1 [view] => checkout [layout] => after_end )

It is funny, that the order is already set as payed->cool->ready for shipping. But only the after_end page can´t access the data (for afilinet stuff and tracking).

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3613

Could you do a dump of the variable $_SESSION ?

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3695

there is a lot of secret stuff in it....it comes by mail.

Last edit: 14 years 1 week ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3699

The code

$app =& JFactory::getApplication(); 
$order_id = $app->getUserState( HIKASHOP_COMPONENT.'.order_id');
should return the order_id based on the dump you sent me. If it doesn't, you should be able to get it directly from the SESSION object:
$order_id = $_SESSION['registry']['_registry']['application']['com_hikashop']['order_id'];

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3703

so far, so good. I used this one here :

$order = $orderClass->loadFullOrder($order_id);

But when I put this in....the hole thing crashed...but it works in the last week....

Last edit: 14 years 1 week ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3705

The $order variable returned by the function loadFullOrder will be empty if:
1 the system cannot for the order with the id given in the database.
2 the current user is different from the user in the order

I recall that we added some code to reset the user_id in the session in one of the latest releases so that users could buy again directly on the store when the store didn't require any registration.

you should add the code

$order = $orderClass->get($order_id);
$app->setUserState( HIKASHOP_COMPONENT.'.user_id',$order->order_user_id );
just before the code
$order = $orderClass->loadFullOrder($order_id);
in order to restore the user_id in the session.

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3707

like this....but this crashed.....

$app =& JFactory::getApplication();  
$order_id = $app->getUserState( HIKASHOP_COMPONENT.'.order_id'); 
$order = $orderClass->get($order_id); 
$app->setUserState( HIKASHOP_COMPONENT.'.user_id',$order->order_user_id );
$order = $orderClass->loadFullOrder($order_id);

//echo $order_id;

this is a little bit too high for me. In the last week it was so easy to accsess the values over..
				<input name="KDNR" type="hidden" value=" ....echo $order->order_user_id;....">  
				<input name="ORDERNR" type="hidden" value="....  echo $order->order_id;   ....">  

Last edit: 14 years 1 week ago by gaborgaborgabor.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3708

Yes like this. There is no reason for this to crash. What is the error you get ?

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3709

just a white screen.....

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
14 years 1 week ago #3710

A white screen won't help :)

Could you activate the display of errors in your php.ini ?

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

  • Posts: 87
  • Thank you received: 10
14 years 1 week ago #3711

Fatal error: Call to a member function get() on a non-object in /html/joomla/templates/naildesign1/html/com_hikashop/checkout/after_end.php on line 16

and this is.........
$order = $orderClass->get($order_id);

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

Time to create page: 0.090 seconds
Powered by Kunena Forum