News:

Support the VirtueMart project and become a member

Main Menu

Two bugs, one fixed - Is this the good place ?

Started by adan, April 11, 2009, 18:28:02 PM

Previous topic - Next topic

adan

Hi,

First bug:
I found a bug in ps_cart.php in the functions delete() and deletesaved(): if your attributes contain some exotic letters like ' for example, you'll not be able to remove a product from the cart after you have added it. This bug can be fixed by  just replacing the following code in these two functions:

|| $_SESSION['cart'][$i]["description"] != $d["description"]


by the code:

|| $_SESSION['cart'][$i]["description"] != stripslashes($d["description"])



Second bug-not fixed, need help:
I am using children products and I kept the presentation by default with a combobox positioned on "Select". If the user forget to choose a product in the combo box and click on "add to cart", he'll be forwarded to a page listing all the products instead of getting a message inviting him to select a product !! The url of the page he gets is:
http://localhost/sitejoomla/index.php?keyword=&category_id=&limitstart=&page=shop.browse&option=com_virtuemart&Itemid=80

Seems it browses for an non existing product but I could not find why and where it is doing that. Actually, I put an echo in the method "add" in the file ps_cart.php where the check if the user has chosen a product occurs but the problem is that this function is even not called.

I noticed that I have this problem only if I choose 'No' regarding the use of Ajax. If I choose yes for Ajax, the problem does not occur any more. The problem is that that I cannot use Ajax.

This problem occurs with all templates.

Hope you can help me.

aravot

Thank you for the fix, committed to SVN for v1.1.4.

Looking into second part of the issue, if you find a fix before us, please post.

macallf

Second problem:

ps_cart.php about line 185

// Quick add of item
$q = "SELECT product_id FROM #__{vm}_product WHERE ";
$q .= "product_parent_id = ".(int)$product_id;
$db->query ( $q );

if ( $db->num_rows()) {
vmRequest::setVar('product_id', $product_id"] );
$vmLogger->tip( $VM_LANG->_('PHPSHOP_CART_SELECT_ITEM',false) );
return false;
}


Change to this

// Quick add of item
$q = "SELECT product_id FROM #__{vm}_product WHERE ";
$q .= "product_parent_id = ".(int)$product_id;
$db->query ( $q );

if ( $db->num_rows()) {
vmRequest::setVar('product_id', $e["product_id"] );
$vmLogger->tip( $VM_LANG->_('PHPSHOP_CART_SELECT_ITEM',false) );
$_REQUEST['flypage'] = ps_product::get_flypage($e["product_id"]);
$GLOBALS['page'] = 'shop.product_details';
return true;
}


this will fix the addtocart when no item selected and ajax is turned off
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.


patrik60

the fix in svn 1724 doesn't solve the problem:
"ps_cart updated to fix wrong page return when item not selected and not using AJAX"

when not choosing a child product or a quantity "back to the shop" leads to the browse page instead of the flypage.

for me it would be logic if customers forget to choose a child product or a quantity he should be leaded back to the flypage of the product.

patrik


patrik60

It really doesn't work as long as I choose "Use List box for child products " in the display options. No problems, when this option is unselected.


patrik60

I have attached three pics: the option in pic1 works fine. it doesn't matter whether AJAX is on or off. I get in both cases the following message: "Info: To add this product into your cart you have to select a product variant on the details page."

the option in pic2 doesn't work: when AJAX is off I will be guided to the empty basket and see only "Continue shopping". clicking on this, I will be guided to the browsepage. When AJAX is on, I will get a nearly empty alert: see pic3

[attachment cleanup by admin]


patrik60

just made a fresh joomla 1.5.10 and VM (latest svn) installation with sample datas. tried this:

go to List Products -> Choose Ladder -> make the following settings in display options: same as in pic2 but selected once "Use check Box " and once "Use Radio Box". The error then also happens.