VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: warrioroftheworth on November 01, 2012, 20:58:48 PM

Title: Customizing default product fields (sku)
Post by: warrioroftheworth on November 01, 2012, 20:58:48 PM
Hi everybody, I need to create a plugin but I dunno how. 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="PR";
if(strstr($cad1,$cad2)){
echo $this->product->product_sku
}
else{
echo 'PR'.$this->product->product_sku
}

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


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