VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: warrioroftheworth on November 02, 2012, 16:37:24 PM

Title: Customizing default SKU product field value
Post by: warrioroftheworth on November 02, 2012, 16:37:24 PM
Hi everybody, I need to create a plugin or anything that could help me but I dunno how to start it. This plugin must create a preffix inside the sku number field. The only "posible solution" I found was by editing the file "administrator\components\com_virtuemart\views\product\tmplproduct_edit_information.php" at line 54 where it has the value of product_sku and replace the value for the next code:


<input type="text" class="inputbox" name="product_sku" id="product_sku" value="<?php 
$cad1=$this->product->product_sku;
$cad2="NOM"//preffix NOM
if(strstr($cad1,$cad2)){
echo $this->product->product_sku
}
else{
echo 'NOM'.$this->product->product_sku
}

?>
" size="32" maxlength="64" />


It obviously works but how could I make this script into a plugin or anything for change the value of the preffix "NOM" and customize this plugin?. Maybe a reference about where I could start please. I´m looking forward your answers and thanks  :)

EDIT: Sorry I forgot, I'm using Joomla 2.5 and Virtuemart 2.0
Title: Re: Customizing default SKU product field value
Post by: warrioroftheworth on November 07, 2012, 18:39:05 PM
Well... Thanks anyway  :(