News:

Support the VirtueMart project and become a member

Main Menu

Customizing default SKU product field value

Started by warrioroftheworth, November 02, 2012, 16:37:24 PM

Previous topic - Next topic

warrioroftheworth

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