Edit Ship-To list (Profile): where has user came from?

Started by AmStaF, April 06, 2012, 20:46:28 PM

Previous topic - Next topic

AmStaF

J2.5.4 + VM2i
Edit shipment addresses: is there any way to check in template where has user came from?

For example, first.

1. Click Profile (main menu, for example).
2. Click the address from the list (to edit) or click link to add new one.
This way, user is expecting that he is in Profile, just looking or editing his data (login/phone/shipment adresses etc.).

Second.

1. Go to Cart (no matter how).
2. Click link to edit shipment address.
3. .. and user will get view to add/edit his shipment addresses (like previous case).
But this way, user is expecting that he still is in "order processing". And in this situation it would be nice to show him the text like "Add/Select address than return to the Cart".

I did not clarify how to check. Both ways we`ve got url like ".../editaddresscartST?cid[0]=0", so it`s useless.

Also there is some code in edit_address.php:

if (strpos($this->fTask, 'cart') || strpos($this->fTask, 'checkout')) {
   echo 'rview = cart<br />';
} else {
   echo 'rview = user<br />';
}

But it`s useless also: "rview = cart" always.

I suppose that checking would be very comfortable and friendly for any user! It will add usability.

PRO


USE JRequest::

<?php if (JRequest::getVar('addrtype')=='BT') OR  (JRequest::getVar('addrtype')=='BT')  { ?>



<?php } ?>

IF you are local, you can turn off SEF urls,and see whats in the url different from each, and use JRequest to display different

AmStaF

Thanks! But I`ve got some troubles...

SEF off:
   addrtype = ST always
   task = editAddressSt or editaddresscart - wonderful!

but

SEF on:
   addrtype = ST always
   task = editaddresscart always :(

I`d like to leave SEF on. Any idea?

PRO

NO, turning SEF OFF is to just show you the parameter.

JRequest  works with the parameter no matter if its on or off.


AmStaF

$addrtype = JRequest::getVar('addrtype') and always is "ST"

I`d like to use

$task = JRequest::getVar('task')

to check "editAddressSt" or "editaddresscart" but it works only if SEF off!

I don`t know the case ...

AmStaF

Wait a second.. Ok, SEF is on. But I have tried to switch off SEO (VMConfig). And now all is ok! I can see difference 'editAddressSt' and 'editaddresscart'.

Thank you!

But.. what about SEO? :)

PRO


AmStaF

Hmm.. I was thinking about it. I have menu item "Profile" and Itemid is the same, no matter where are you coming from: from profile (direct menu) or from cart by link.

Upd.: And again! Itemid works only if SEO is off. And there is some fun :) in this case itemid doesn`t change when you go from the cart to the profile (link to select ST). This is why Itemid is usefull: no changes stores the original source :)

Is there seperate menu item for vm-addresses (to handle individual Itemid)? Maybe it`s a solution?

AmStaF

By the way, here is something more about friendly and usability.

Now, VM has two links from the Cart: to edit profile (BT) and to edit addresses (ST). For these actions any user will be expecting different interfaces. But for now we show the addresses list (ST) for both of that cases (BT and ST)!

As for me, I`ve added a few lines to user/edit_address.php that will not show any addresses list if user comes from the Cart through BT-link:

if ($this->address_type != 'BT') {
   if ($this->userDetails->JUser->get('id')) echo $this->loadTemplate('addshipto');
} else {
   ...some code...
}

Maybe it`d be useful for someone.