Hi there,
I'm trying to move the custom field variant (for colours etc) in-between the quantity box and add to cart button as seen in the attachment. I can move the custom field variant while inspecting element in chrome, but I can't seem to find the php I need to move and I was wondering if someone could help me?
I'm using VM3.09
Thanks,
Richard
no idea if possible but the file with the add to cart is templates/YOUR_TEMPLATE/html/com_virtuemart/sublayouts/addtocartbar.php
try adding echo shopFunctionsF::renderVmSubLayout('addtocartbar',array('product'=>$product)); between the quan and add to cart button and remove that snippet from
templates/YOUR_TEMPLATE/html/com_virtuemart/sublayouts/addtocart.php
Hi GJC,
I've tried doing that but I must be either missing something or editing it wrong. It keeps breaking my layout. I have tried placing it in different parts of addtocartbar.php it seems it will most likely work with the correct placement and tags, just I'm not the best with editing php. I did manage to get it almost working, it was just my layout that was broken :(
I don't suppose you could have another look for me and see if there's a way to solve this please?
Thanks,
Richard
QuoteI've tried doing that but I must be either missing something or editing it wrong.
indeed .. if the layout breaks then it isn't correct...
but perseverance is a golden personality trait.. :) -- I'm not saying it will work as your adding code into a form.. but if done right it at least won't break the layout..
Hi GJC,
Yeah I won't stop until this is done, no matter how long it takes!
I've still not managed to fix, this is the best result I can get so far
<!-- <label for="quantity<?php echo $product->virtuemart_product_id; ?>" class="quantity_box"><?php echo vmText::_ ('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
<span class="quantity-box" class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-minus" value="–"/>
<input type="text" class="quantity-input js-recalculate" name="quantity[]"
onblur="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
onclick="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
onchange="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
onsubmit="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
value="<?php echo $init; ?>" init="<?php echo $init; ?>" step="<?php echo $step; ?>" <?php echo $maxOrder; ?> />
<input type="button" class="quantity-controls quantity-plus" value="+"/>
<?php echo shopFunctionsF::renderVmSubLayout('addtocartbar',array('product'=>$product)); } ?>
</span>
If I place <?php echo shopFunctionsF::renderVmSubLayout('addtocartbar',array('product'=>$product)); } ?> anywhere else it gives a 500 error. I don't suppose you could spot any issues, like I said I'm not very good with php :(
Thanks for all the help,
Richard
Hi GJC,
I think we both forgot one very easy thing, use the "custom field" "layout position" and I set to "addtocart" and it is now above the quantity box.
I was wondering, would I be able to make a new position in-between the cart and quantity and then use this method? If yes could you be kind enough to post the code for me to copy n paste so I can do it?
Thanks again,
Richard
afaik you just call it what you want...
echo shopFunctionsF::renderVmSubLayout('myposition',array('product'=>$product));
then write that in the custom admin
Hi GJC,
Thanks for that, it works placing it in my "addtocartbar.php" but it seems it just doesn't want to be in-between quantity and addtocart button. I've currently got it above the quantity box and I think this is where I'll leave it as it seems to be better as I have large lists and only short descriptions so it saves a little whitespace.
Thanks for all your help with this thread.
Richard