When you change the language, then you cannot see the product in the list. So I wonder how you do that. You must "tricks" it. I mean, you stay in the product, makes sense, but when you would leave the product, you would not be able to edit it in the wrong language and you could not create a child.
Hmm.. Below is a description of 'how to do that'. Maybe that's why, as you called it, I "trick it".
First of all - Administrator's language (English) is different from the default language site (Polish) - it's because I'm able to learn and look through VM much more easily in searching for any help and so on in English.
Using "No Fallback" I fill in the translation for the default language site (Polish) and leave empty English if I don't need it.
Doing so, I can see the product in the list for both languages, but when the Administrator's language is English I can't create the child product due to error I've mentioned.
Please edit the product model /administrator/components/com_virtuemart/models around line 2257 (function createChild) and add
VmConfig::$vmlang == VmConfig::$defaultLang;
I can see the function, but where exactly should I put the code?
public function createChild ($id) {
if(!vmAccess::manager('product.create')){
vmWarn('Insufficient permission to create product');
return false;
}
// created_on , modified_on
$db = JFactory::getDBO ();
$db->setQuery ('SELECT `product_name`,`slug`,`virtuemart_vendor_id` FROM `#__virtuemart_products` JOIN `#__virtuemart_products_' . VmConfig::$vmlang . '` as l using (`virtuemart_product_id`) WHERE `virtuemart_product_id`=' . (int)$id);
$parent = $db->loadObject ();
$prodTable = $this->getTable ('products');
$childs = $this->getProductChildIds ($id);
if($childs){
$lastCId = end($childs);
reset($childs);
if(!empty($lastCId)){
$db->setQuery ('SELECT `product_name`,`slug`,`virtuemart_vendor_id` FROM `#__virtuemart_products` JOIN `#__virtuemart_products_' . VmConfig::$vmlang . '` as l using (`virtuemart_product_id`) WHERE `virtuemart_product_id`=' . (int)$lastCId);
$lastChild = $db->loadObject ();
if(!empty($lastChild->slug)){
$prodTable->slug = $lastChild->slug;
}
}
} else if(empty($parent->slug)){
$prodTable->slug = $parent->product_name;
} else {
$prodTable->slug = $parent->slug;
}
$prodTable->checkCreateUnique('#__virtuemart_products_' . VmConfig::$vmlang,'slug');
//$newslug = $prodTable->checkCreateUnique('products_' . VmConfig::$vmlang,$parent->slug);
$data = array('product_name' => $parent->product_name, 'slug' => $prodTable->slug, 'virtuemart_vendor_id' => (int)$prodTable->virtuemart_vendor_id, 'product_parent_id' => (int)$id);
$prodTable = $this->getTable ('products');
$prodTable->bindChecknStore ($data);
return $data['virtuemart_product_id'];
}