Author Topic: Text of button Choose a product variant is editable  (Read 1987 times)

ETSM

  • Beginner
  • *
  • Posts: 10
Text of button Choose a product variant is editable
« on: March 26, 2015, 14:41:13 pm »
Joomla! 3.4.1
VirtueMart 3.0.6.2

Hi,

The Text of the button "Choose a product variant" is editable.
Of course changes in that text are not saved and is is harmless, but still, it is not how it should be.
It is the button that appearce automaticaly when a client needs to choose a child variant before he can add it to his cart.
After choosing one variant, that button changes into add to cart button automatically (than the issue is gone).
It's not the end of the world but I just hope it could be improved in a next version.
I have tested it in multiple websites with various templates and this issue is the same in all wesites.

best,
E

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Text of button Choose a product variant is editable
« Reply #1 on: March 26, 2015, 14:47:25 pm »
The question is more if the button works then. Editable is anything
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bart198x

  • Beginner
  • *
  • Posts: 29
Re: Text of button Choose a product variant is editable
« Reply #2 on: April 05, 2015, 22:48:17 pm »
I think I know what is about.
in flie components/com_virtuemart/helpers/shopfunctionsf.php there is a line 90 in my case and it tells:

Code: [Select]
$html = '<input name="addtocart" class="addtocart-button-disabled" value="'.vmText::_( 'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'" title="'.vmText::_( 'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'" />';

I have change it (twice - after update of course chanages dissapperas because it's a helper) to:
Code: [Select]
$html = '<span class="addtocart-button-disabled"> '.vmText::_( 'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).' </span>';

And that works
Products are added afeter that change too.
This can be checked on http://belladonnafashion.eu/sklep/jesien-zima-2014-15/sukienka-1-detail for a while (until I finish)
It seems that simple text was put into input field just for copy paste reason. :) (or maybe some more advanced reson)

ETSM

  • Beginner
  • *
  • Posts: 10
Re: Text of button Choose a product variant is editable
« Reply #3 on: April 13, 2015, 09:59:13 am »
Thanks! Seems to work like a charm.

bart198x

  • Beginner
  • *
  • Posts: 29
Re: Text of button Choose a product variant is editable
« Reply #4 on: May 18, 2015, 18:04:23 pm »
I got tired of overwriting helper, so it can be done too be making override of addtocart.php from /templates/Your_template/html/com_virtuemart/sublayouts and adding Jquery script TO THE END OF FILE (if there is no <?php open tags or something - in my file there was no such :) )

I use  jQuery 1.11.2- didn't test on other.
Why that file? Because it is triggered after that input box originally is created and it is triggered by ajax change too, so... why not :) works.

Code: [Select]
<script>
(function($) {
//change input .addtocart-button-disabled to <span>
$('input.addtocart-button-disabled').replaceWith(function(){
return '<span class='+this.className+'>'+this.value+'</span>'
});
})(jQuery);
</script>

I didn't either check how it behaves on catalog only, I don't need that.
The class is the same so styling shouldn't be problem, in my case it was not.

after all cache clean I see that there is one problem / I'll invastigate that tomorrow

Script is ok I f..... some things. Too many files on board.
I make mess in customefields.php in sublayouts (making buttons in replace of select option)