VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: adan on April 11, 2009, 18:28:02 PM

Title: Two bugs, one fixed - Is this the good place ?
Post by: adan on April 11, 2009, 18:28:02 PM
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.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: aravot on April 17, 2009, 03:16:24 AM
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.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: macallf on April 18, 2009, 15:35:12 PM
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
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: aravot on April 18, 2009, 19:17:43 PM
Thank you Mark, both issues are fixed.
Title: svn 1724
Post by: patrik60 on April 19, 2009, 00:42:58 AM
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
Title: Re: svn 1724
Post by: aravot on April 19, 2009, 02:09:47 AM
Works for me.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: patrik60 on April 19, 2009, 04:17:51 AM
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.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: aravot on April 19, 2009, 04:20:39 AM
It works for me, if it doesn't for you than you have to give your configuration setup and steps to duplicate.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: patrik60 on April 19, 2009, 04:36:55 AM
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]
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: aravot on April 19, 2009, 05:59:46 AM
Based on screenshots I was able to duplicate, however this only happens when no quantity is selected.
Title: Re: Two bugs, one fixed - Is this the good place ?
Post by: patrik60 on April 19, 2009, 06:55:40 AM
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.