Hy there, i have a plugin, have installed in joomla, activated and make the option to be required on the costum fields place, by selecting yes to it...
But when i go to override the file omponents/com_virtuemart/views/productdetails/tmpl/default_addtocart.php, nothing happens, so i believe that the right file to add the code is in public_html/templates/gk_storebox/html/com_virtuemart/productdetails/default.php, when adding the code, like the instructions, cant add right after Just below: echo JHTML::tooltip (vmText::_($field->custom_tip), vmText::_ ($field->custom_title), 'tooltip.png'); gives a blank page, and after the code: $custom_title = null ;
if(is_array($this->product->customfields) && count($this->product->customfields)) :
foreach ($this->product->customfields as $field) : ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
<?php if ($field->custom_title != $custom_title) : ?>
<span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
<?php if ($field->custom_tip) :
echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png');
endif;
endif; ?>
The page works, but the plugin dont block when adding the product to cart...
The Plugin seller instructions:
Edit the “default_addtocart.php” file in Virtuemart.
Please note: if you are using a custom Virtuemart theme you would need to edit the associated file for the custom theme.
We have included a few different version of Virtuemart’s default addtocart file. You can use this to simply override the existing file on your web server. We are not responsible for possible variations in coding between versions. To ‘play it safe’ open the file in a text editor such as Notepadd++ and add the code.
The path to the file: components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php
Around line 20, just below “defined('_JEXEC') or die('Restricted access');”
Add this code block:
/* Required Custom Fields- Start */
JHtml::_('behavior.formvalidation');
$doc = JFactory::getDocument();
$doc->addScriptDeclaration('
jQuery(document).ready(function(){
form = jQuery("form.product")
if(form.attr("name") != "formvalidate"){
form.attr("name","formvalidate");
}
addcart = form.find("input.addtocart-button");
addcart.addClass("validate");
form.find(":input").each(function(){
if(jQuery(this).attr("required"))
jQuery(this).addClass("required");
});
addcart.unbind( "click" );
addcart.click(function(){
myform = document.formvalidate;
document.formvalidator=new JFormValidator;
if(document.formvalidator.isValid(myform)){
Virtuemart.sendtocart(jQuery(myform));
return false;
} else {return false;}
});
});
');
/* Required Custom Fields- End */
Around Line: 74.
Just below: echo JHTML::tooltip (vmText::_($field->custom_tip), vmText::_ ($field->custom_title), 'tooltip.png');
Add this code block. Including <?php and the closing ?>:
<?php
/* Required Custom Fields- Start */
JPluginHelper::importPlugin('system');
$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger( 'onDisplayCustomField', array(&$field) );
/* Required Custom Fields- End */
?>
Could anyone give me a help?
Thanks