Custom Joomla website design and development.

Home Knowledge Base VirtueMart VirtueMart Itemid Bug

VirtueMart Itemid Bug [SOLVED]

Rate this item
(1 vote)

VirtueMart has a nasty little bug some people may have noticed relating to the shopping cart. For some reason, the cart loses its proper Itemid and reverts to whatever Itemid is associated with the Home page. This issue has hounded me for a while, and I've tried to create templates that are able to handle this problem rathar than solve it. However, I have a simple solution that appears to work.

FILE: administrator/com_virtuemart/html/checkout.index.php
LINE: 96

REPLACE
if ($perm->is_registered_customer($auth['user_id'])) { // user is logged in and a registered customer
$basket_html .= '<form action="'. SECUREURL.basename($_SERVER['PHP_SELF']) .'" method="post" name="adminForm">'
WITH
if ($perm->is_registered_customer($auth['user_id'])) { // user is logged in and a registered customer
$basket_html .= '<form action="'. SECUREURL.basename($_SERVER['PHP_SELF']) .'?option=com_virtuemart&Itemid=[**ENTER CART ITEMID**]" method="post" name="adminForm">

By adding the shopping cart Itemid on the end, you ensure that this form will always submit to the right place. You could also use your general VirtueMart Itemid as an alternative.

FILE: administrator/components/com_virtuemart/ps_userfield.php
LINE: 319

REPLACE
if( $startForm ) {
echo '<form action="'. $mm_action_url .basename($_SERVER['PHP_SELF']) .'" method="post" name="adminForm">';
}
WITH
if( $startForm ) {
echo '<form action="'. $mm_action_url .basename($_SERVER['PHP_SELF']) .'?option=com_virtuemart&Itemid=[**ENTER CART ITEMID**]" method="post" name="adminForm">';
}

There are some issue that I can think of that this may create -- namely that if you are viewing your account and update your address you will inherit that Itemid. This is probably not an issue in most situations, but if someone has a better solution I'd be happy to include it.

Trevor Bice

Trevor Bice

Owner, Joomla Expert

...I'm a one man army

E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it
More in this category: « Prev Next »