Text of button Choose a product variant is editable

Started by ETSM, March 26, 2015, 14:41:13 PM

Previous topic - Next topic

ETSM

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

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

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:

$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:
$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


bart198x

#4
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.

<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)