Author Topic: Disable addtocart button per availability  (Read 633 times)

stawebnice

  • Jr. Member
  • **
  • Posts: 229
  • What does not kill you, makes you stronger...
    • StaWEBnice - www stránky, seo optimalizace a copywriting
  • Skype Name: peta_ze_sklepa
  • VirtueMart Version: 3.2.14
Disable addtocart button per availability
« on: December 28, 2017, 10:59:09 am »
Hi,

please is  there a way to disable addtocart button for selected availability? I have an eshop where stocks do not apply for all products, so using general config for 0 stock is not a solution. But there is an image availability vyprodano.jpg (sold out) for which I would need to disable add to cart and replace it by notify  button.


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7729
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Disable addtocart button per availability
« Reply #1 on: December 28, 2017, 11:29:46 am »
vyprodano.jpg  ?  applied as a custom field?

If so  .. detect if the field is present.. if so hide/replace the add to cart
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3029
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Disable addtocart button per availability
« Reply #2 on: December 28, 2017, 16:43:20 pm »
Hi,
It's possible to write a little plugin to use a custom field to disable add to cart button(or other feature)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9588
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Disable addtocart button per availability
« Reply #3 on: December 29, 2017, 11:56:51 am »
Not sure, but I think you need only to enable one option. Ah yes "Stockhandling on product level ", it is directly above the radio list of the options "Action when a Product is Out of Stock"
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

stawebnice

  • Jr. Member
  • **
  • Posts: 229
  • What does not kill you, makes you stronger...
    • StaWEBnice - www stránky, seo optimalizace a copywriting
  • Skype Name: peta_ze_sklepa
  • VirtueMart Version: 3.2.14
Re: Disable addtocart button per availability
« Reply #4 on: December 29, 2017, 19:19:37 pm »
Hi,

not as custom field, but as availability field - image.

People must be able to order other products with 0 stock that have different availability images (one week etc.) but this one availability means sold out - for lets say couple months, so he does not want to unpublish the product yet. But we want to allow them to fill in the Notify me form for this product.




GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7729
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Disable addtocart button per availability
« Reply #5 on: December 30, 2017, 11:47:25 am »
then this is the way

Quote
If so  .. detect if the field is present.. if so hide/replace the add to cart

check for the image name - probably do it in templates\xxxxxx\html\com_virtuemart\sublayouts\addtocartbar.php
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9588
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Disable addtocart button per availability
« Reply #6 on: January 02, 2018, 11:17:53 am »
Not sure, but I think you need only to enable one option. Ah yes "Stockhandling on product level ", it is directly above the radio list of the options "Action when a Product is Out of Stock"

Ehrm?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3298
  • using Matomo instead of Google Analytics
Re: Disable addtocart button per availability
« Reply #7 on: January 02, 2018, 23:13:04 pm »
I just assign a different product details page on which the AddToCart button is disabled to those products and add a 'sold out' text into the availability text field.

For this I've created a different sublayout which is a copy of 'addtocart.php' with the addtocart button disabled and named it 'noaddtocart.php'.

Then created a copy of ...\components\com_virtuemart\views\productdetails\tmpl\default.php and replaced
Quote
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$this->product));
with
Quote
echo shopFunctionsF::renderVmSubLayout('noaddtocart',array('product'=>$this->product));
and stored that as 'not-available.php', which I can select as the Product Details Page.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3029
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Disable addtocart button per availability
« Reply #8 on: January 02, 2018, 23:27:16 pm »
JJK, this solution does not work on category view or modules .

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3298
  • using Matomo instead of Google Analytics
Re: Disable addtocart button per availability
« Reply #9 on: January 02, 2018, 23:34:14 pm »
JJK, this solution does not work on category view or modules .
True, but I don't have that problem, because I disabled the addtocart button in those (in order to force my customers to look at the full description before adding a product into the cart)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations