News:

Support the VirtueMart project and become a member

Main Menu

Making Custom field Cart variant required

Started by johk, October 20, 2012, 12:43:17 PM

Previous topic - Next topic

johk

Hi,

Say I have a t-shirt that comes in different sizes. I can setup the sizes and different prizes for them using the Custom Field Cart Variant. Is it possible to make it a required field ie the user has to choose a size from the dropdown.
I realise this can be done with cart control but for this shop it is not required.

Any suggestion most appreciated.

Johk

KieranMcClung

This is also a problem I am facing.

Currently the site I'm creating allows for colour selection, although this doesn't affect the price of the product. So it's currently set up with a cart attribute drop down list of colours. Someone can add the item to the basket regardless of selecting a colour, and this isn't ideal.

To the OP, did you find a solution? Or to anyone else is there a solution out there?

I'm quite new to VM so I might be misunderstanding terminlogy and the use of certain attributes, and such, so apologies if I'm misunderstanding things.

Thank you.

GJC Web Design

Haven't tried this but the code for the Add to cart is in

components/com_virtuemart/helpers/shopfunctionsf.php ~ line 98

I would copy this code into a components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php template overide (i.e. call it directly)

if($this->product->orderable){
vmJsApi::jPrice();
$html = '<input type="submit" name="addtocart" class="addtocart-button" value="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" title="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" />';
} else {
$html = '<input name="addtocart" class="addtocart-button-disabled" value="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" title="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" />';
}


and try detecting your attribute with jquery etc to manipulate the add to cart.. maybe hide the <span class="addtocart-button"> span if dropdown not selected
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tradexl

#3
i just want to know that how to put written text box on item details page? and if client complete that text box than how to get that text box value.?

PolishedGeek

You can do this with a custom field, customer input text.
~ Deb Cinkus, CEO
Polished Geek, LLC   |    www.PolishedGeek.com

Creators of JoomLister - eBay Lister for Joomla!