News:

Looking for documentation? Take a look on our wiki

Main Menu

Add To Cart From Category and Generic child variant

Started by rayge, June 04, 2013, 23:49:24 PM

Previous topic - Next topic

rayge

Sorry i had this in the wrong place so i moved it here.

Generic child variants arent working for me

1. they show whatever the first product is in all subsequent downpdowns.
2. its not picking the item in the dropdown, its picking the parent product which shouldn't even be purchasable.

Heres the code I am using.

<div class="addtocart-area">

<?php 
//echo "<pre>";
//print_r($this->products);
//echo "</pre>";
?>


    <form method="post" class="product js-recalculate" action="index.php" >

<?php // Product custom_fields
if (!empty($product->customfieldsCart)) { ?>

    <div class="product-fields">
<?php foreach ($product->customfieldsCart as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><strong><?php echo JText::_($field->custom_title?></strong></span>
<?php if ($field->custom_tip)
    echo JHTML::tooltip($field->custom_tipJText::_($field->custom_title), 'tooltip.png'); ?>

<span class="product-field-display"><?php echo $field->display ?></span>

<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
    </div><br />
    <?php
}
?>

    </div>
<?php
}
/* Product custom Childs
 * to display a simple link use $field->virtuemart_product_id as link to child product_id
 * custom_value is relation value to child
 */

if (!empty($product->customsChilds)) {
    ?>

    <div class="product-fields">
    <?php foreach ($product->customsChilds as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><strong><?php echo JText::_($field->field->custom_title?></strong></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value?></span>
<span class="product-field-display"><?php echo $field->display ?></span>

    </div><br />
<?php ?>
    </div>
<?php 
}
?>



<div class="addtocart-bar">

<?php // Display the quantity box

    
$stockhandle VmConfig::get('stockhandle''none');
    if ((
$stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock $product->product_ordered) < 1) {
 
?>

<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id='.$product->virtuemart_product_id); ?>" class="notify"><?php echo JText::_('COM_VIRTUEMART_CART_NOTIFY'?></a>

<?php } else { ?>
<!-- <label for="quantity<?php echo $product->virtuemart_product_id?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
    <span class="quantity-box">
<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($product->min_order_level) && (int) $product->min_order_level 0) {
    echo 
$product->min_order_level;
} else {
    echo 
'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>
    <?php // Display the quantity box END ?>

    <?php
    
// Display the add to cart button
    ?>

<span class="addtocart-button">
<input type="submit" name="addtocart" class="addtocart-button" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" />
</span>
<?php ?>

    <div class="clear"></div>
</div>

<?php // Display the add to cart button END  ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
    </form>

    <div class="clear"></div>
</div>


HELP??
I Use: Joomla 3.4.1 & VM 3.0.9

Milbo

I am sorry, I cannot follow your issue. What is this for a code? Why do you not use the standard one?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

rayge

Where is there standard code for allowing a user to add to cart from the product listings within a category? I would gladly try it out.
I Use: Joomla 3.4.1 & VM 3.0.9

Milbo

There is none and therefore this is not a bug, it is a template thing and there are a lot snippets provided.

It will be added in vm2.1. Atm there are combinations of customfields which cannot work in the category view correctly
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

Milbo

Great - available in 2.1  fantastic news!!

If there are loads of custom fields etc for a prodcut - just make the button non display as per old VM1.1

If they need lots of custom details - they can always add a "quick look" / "quick view" feature in category page

Quicklook or quickview is becoming extremely popular for customers and sites (where numerous products exists in a category), as it reduces the need to bounce in and out of the detailed product.

We have seen a significant increase in sales since we introduced this feature to our site.
Regards
A

Joomla 4.4.5
php 8.1

rayge

OKay well in that case i already coded it so if there are CHILD products the add to cart is removed and instead the user is forced to click to go to the product details to make their choices.

I will TRY to remember to check ito ut in VM 2.1 and see how it does.
I Use: Joomla 3.4.1 & VM 3.0.9

Milbo

The solution to buy a quick look feature for vm is imho the best, avoids also trouble with variants and so
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

Oh no Milbo  :'(

I was looking forward to quicklook feature without having to depend on third party options!  Of course if it is a team developed option then that is different, happy to pay and use one of those where necessary!

You all need to eat.  Just don't get the taste for champagne!

Oh well, looks like I build my own without us of iframe!

If I can that is    :o
Regards
A

Joomla 4.4.5
php 8.1

Milbo

I saw stuff like that already. It should not be more than  15 euro. I think there are already code snippets for that in the template forum
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lindapowers

#9
I will gladly pay the core team for this solution too, dont want more nasty plugins at the backend and don't like the fact that our customers have to click in the product details in order to select their product.

Yes Max, there's a big post about it but the code keeps changing as the core does and is not specifically intended for the generic child variants but for the general category view, our template providers already include that option, the problem comes with child products, no button or dropdown is displayed until you click the detailed view.

We used the product description to tell our customer to "pls click in product details in order to select your favourite blabla", same as we did with the parent product title - "several flavour for you to choose from". Rudimentary solutions for now which im not very uhappy with tbh but in the future if possible this would be more than welcome.

Regards

AH

lindapowers

I built a quik look view from the category page.
It does not use tons of javascript (as do some of the plugins)

I did have it allowing addition to the cart but, I could not work out how to get the addition to the cart to update the cart without a page refresh

If you can work out how to do that then you are welcome to my code

I simply built a new view.

Regards
A

Joomla 4.4.5
php 8.1

sorema

Quote from: rayge on June 13, 2013, 19:36:39 PM
OKay well in that case i already coded it so if there are CHILD products the add to cart is removed and instead the user is forced to click to go to the product details to make their choices.

I will TRY to remember to check ito ut in VM 2.1 and see how it does.
please can you share the code? i do need to do this same. thank you