VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Banzelcroftcustoms on July 09, 2019, 07:39:53 AM

Title: Attributes of item purchased showing customer picked all but they cant
Post by: Banzelcroftcustoms on July 09, 2019, 07:39:53 AM
I am using vm 3.4.2. on Joomla 3.9.8 but have had this issue since the start of my website roughly 1 to 2 years ago but only happens occasionally.

I am a knife maker so when you purchase a knife there are 3 drop down boxes you can pick 1 add on from each.
Sheath color : black or brown
Jimping : add or don't add
Belt attachment : add or don't add

I'm not sure what is happening on the front end with the customer to cause this but on the backend, there are times it shows me they chose all 6 options. Being both sheath colors, yes and no to jimping, yes and no to the belt attachment.

The price reflects what they got but since the attachment and jimping are both the same add on price, I can't just guess which one they chose. And for the sheath color it showing they chose black and brown, forces me to email them and ask as well.

I am not an expert at web coding and use a simple template and virtuemart but other than that, I don't have any special code I have added to my site. My knowledge is rather limited in that regard so I don't think I messed anything up that way. I'm wondering if the customer is timing out and coming back? I really have no idea. I attached an image of the backend to show you how it looks for me.

My url www.banzelcroftcustoms.com

Mykel
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Jörgen on July 09, 2019, 10:45:27 AM
Hello

This happens when You add the item from the category page. I thought I had seen the ability to turn the addtocart button off in configuration, but can not find it. You can however remove the addtocart button in the template file.

Make an override of the products.php
and change:
defined('_JEXEC') or die('Restricted access');

to
defined('_JEXEC') or die('Restricted access');
$view = vRequest::get('view');[/code]

And change approx line 127
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop', 'addtocart'))); ?>

to
if ($view =="productdetails")
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop', 'addtocart'))); ?>


That removes addtocart in the category view.

These lines are not tested, I use a different override, but with similar result.

Jörgen @ Kreativ Fotografi


Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Banzelcroftcustoms on July 09, 2019, 23:15:42 PM
Awesome I will attempt to disable that button. Thank you!
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Banzelcroftcustoms on July 10, 2019, 00:42:44 AM
I am unsure of where to find this product.php section. I went to templates and clicked on "editor" , "create overrides" , "template description" and I am not seeing where there is product.php.

I apologize for my inexperience with this.
Mykel
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Jörgen on July 10, 2019, 05:54:32 AM
You have to create the override com_virtuemart and then choosing sublayouts. Then I think you can edit the sublayout products.php. you can also copy only the products.php to your-template/html/com_virtuemart/sublayouts. There are olnty of examples in the forum how to make an override in the event that I have made some small typo.
Jörgen @ Kreativ Fotografi
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: jenkinhill on July 10, 2019, 16:10:04 PM
You cannot make sublayout overrides using Joomla's Create Overrides editor.

To create a sublayout override you should use ftp to first set up a suitable override folder, joomlaroot/templates/protostarplus/html/com_virtuemart/sublayouts/  - it looks like you already use overrides, so this folder may already exist, if not then create it.

If there are already sublayout overrides then look for products.php in that directory and download it for editing in a suitable plain text editor such as NoteTab. if there is not already a products.php file then download the products.php file in joomlaroot/components/com_virtuemart/sublayouts/

In either case edit the file to remove  (or comment out)  the div containing

<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>

Note this is the code in the current VM version default template.

Save the edited file and ftp into your template override folder.  That should fix it.
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Jörgen on July 10, 2019, 23:06:31 PM
@jenkins In this case the addtocart button should only be removed from the category page. Hence my code. Just commenting the line is not enough.

Jörgen @ Kreativ Fotografi
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: jenkinhill on July 11, 2019, 11:20:00 AM
Soory Jörgen, but no, for productdetails the addtocart sublayout is called direct from components/com_virtuemart/views/productdetails/tmpl/default.php  so my override does not remove add to cart from the product pages.  I think this is what the OP needs.
Title: Re: Attributes of item purchased showing customer picked all but they cant
Post by: Jörgen on July 11, 2019, 12:45:11 PM
@jenkins I stand corrected, You are right. This makes my solution a bit more complicated than necessary.

best regards

Jörgen @ Kreativ Fotografi