Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - PureMart (SKU# FLEX-00010)

TOPIC: Add2Cart Btn Wrong when using Stockable Variants

Add2Cart Btn Wrong when using Stockable Variants 11 years 2 months ago #2764

Hi I have normal stand alon products and lots of Parent/Child using stockable variant.

Using the exact same puremart product detail template I have noticed that in the standalone products the add to cart button and quantity shows up nice using the themes styling.

But when the product has children which use stockable variant plugin, the add to cart button shows as the virtemart default button?

Any ideas on why this may be?

Products with Dynamic Children

Attachment ScreenShot2013-03-02at22.46.28.png not found


Stand Alone Product

Attachment ScreenShot2013-03-02at22.45.57.png not found



Last Edit: 11 years 2 months ago by Andy Connell.
The administrator has disabled public write access.

Add2Cart Btn Wrong when using Stockable Variants 11 years 2 months ago #2767

Hi Andy,

Is the std button still shown for products with children but not using the "stockable varient" (just so we can track this down) :)

If your site is live could you post a link to it so we can have a look..

Regards,

Admin
Last Edit: 11 years 2 months ago by John.
The administrator has disabled public write access.

Add2Cart Btn Wrong when using Stockable Variants 11 years 2 months ago #2771

Hi Andy, me again with some news:

We have implement a new style and look for "add to cart" button with using CSS3 but this fails to work when the "Custom Field VM Stock Variant" is being used.

Because the "notify" button which needs to show when the child is out of stock is handled by a native VM routine - not our one which is showing the css3 style button (for parent products).

It is the drawback. It is also same in our DEMO.

The solution is only possible with modifying the "vmcustom" plugin that comes with the Virtuemart Component, but since it is a core virtuemart plugin, it is not recommended to make any change in that plugin to avoid any possible bad results in the future (and eventually core changes will be retrieved back to stock once the virtuemart is updated).

If you don't care about the "stock" then you can use the ordinary "Cart Variant" custom field type, it is relatively simpler to setup and easy to control, also in the layout everything will be good to go.

Regards,

Admin
The administrator has disabled public write access.

Add2Cart Btn Wrong when using Stockable Variants 11 years 2 months ago #2774

My choice to use stockable variant, was to stop duplicate URL's when viewing thechild products.

When you use the ordinary cart variant and you have maybe 10 children (of differnet sizes/colors), every time you view a child the URL's changes & we didn't want multiple URL's and duplicate content showing all over search engines.

Would you have any idea what may need altering in stockable variant plugin to get this working?

I'm not a fan of altering VM core code, but as it is only the stockable variant plugin, is this still classed a s a core hack?


Alternatively what Can I do CSS wise just to get the button showing similar to the single products.


As a last option, I guess I could use the normal Add to cart button on all single product pages too!
The administrator has disabled public write access.

Add2Cart Btn Wrong when using Stockable Variants 11 years 2 months ago #2776

Hi Andy -
re whether core file.. hmmm.. VM are quite "brutal" sometimes with their updates.. if you choose to adapt I would just check each update if the stockable variant plugin has been changed...

As to changing it - I don't know what your technical ability is but i will try and point you in the right direction...

This add to cart button is changed by the plugin for "availability" by Jquery
if ("disableadd" == stockhandle && stockable_'.$js_suffix.'[found_id].in_stock <= 0) {
					$(".addtocart-bar>span").remove();
					$(".addtocart-bar>div").remove();
					$(".addtocart-bar>a.notify").remove();
					$(".addtocart-bar").append(\'<a href="ind\'+\'ex.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=\' + found_id + \'" class="notify">' . JText::_('COM_VIRTUEMART_CART_NOTIFY') . '</a>\');
				} else {
					var quantity = $(".addtocart-bar .quantity-input").val();
					$(".addtocart-bar>span").remove();
					$(".addtocart-bar>div").remove();
					$(".addtocart-bar>a.notify").remove();
					$(".addtocart-bar").append(\'<span class="quantity-box"><input type="text" class="quantity-input js-recalculate" name="quantity[]" value="1" /></span><span class="quantity-controls js-recalculate"><input type="button" class="quantity-controls quantity-plus" /><input type="button" class="quantity-controls quantity-minus" /></span><span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="'.JText::_('COM_VIRTUEMART_CART_ADD_TO').'" title="'.JText::_('COM_VIRTUEMART_CART_ADD_TO').'" /></span><div class="clear"></div>\');
					Virtuemart.product($("form.product"));
				}
 
				$(".availability").remove();

if you look at the source of the css3 button we use you can see the html of the button is different
 
<div class="addtocart-bar FlexibleProductDetailsAddToCartBar">
			<!-- <label for="quantity5" class="quantity_box">Quantity: </label> -->
 
        <input type="hidden" value="1" name="quantity[]" class="quantity-input js-recalculate">
 
        <span class="FlexibleCSS3Button">
<input type="submit" name="addtocart" value="Add to Cart" title="Add to Cart" class="addtocart-button FlexibleCSS3Button-text">        
 
<span class="FlexibleCSS3Button-slide-text">							 
		 <span class="FlexibleProductDetailsInStock">product in stock</span> 
                             <span class="FlexibleProductDetailsStockNumber">(150)</span>	
 
</span>
<span class="FlexibleCSS3Button-icon-right"> <span></span></span>
</span>
 
	<span class="FlexibleProductDetailsStockInfo">					  
						                        	</span>                
	    <div class="clear"></div>
	</div>

i.e. a couple of extra spans and a class added to allow the injection of the product in stock etc..

You would need to make the the html of the JS above match this..

if you look in

templates/YOUR_TEMPLATE/html/com_virtuemart/productdetails/default_addtocart.php from line 62 you'll see what I'm going on about..

Hope this gives you a few pointers..

Cheers
The administrator has disabled public write access.
Time to create page: 0.075 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo