Editing of product on FE - to return to native category

Started by fsv, January 02, 2014, 19:43:44 PM

Previous topic - Next topic

fsv

J2.5.17 + VM2.0.26a + Beez2
Now at editing of product on FE at saving of changes there is a redirect on /index.php.
And if I want to edit other goods further? Again to do 1-N clicks to the necessary category?
The possible decision:

/components/com_virtuemart/views/productdetails/view.html.php
line 237
$edit_link = JURI::root(). 'index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id;
to replace on
$edit_link = JURI::root(). 'index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id;

/administrator/components/com_virtuemart/helpers/vmview.php
In static function getToolbar($vmView) after
$document->addCustomTag(...);
to add
$j = '
jQuery(function($) {
//to replace following image with bigger
$("body").append("<img src=\"/components/com_virtuemart/assets/images/facebox/loading.gif\" id=\"vm_preloader\" style=\"display:none; width:250px; height:250px; position:fixed; top:50%; left:50%; margin-left:-125px; margin-top:-125px; z-index:100000;\" />");
$("#toolbar-save a").click(function(){
$("#vm_preloader").show();
$("#adminForm input[name=\'task\']").val("save");
$.ajax($("#adminForm").attr("action"), {
type: "POST",
data: $("#adminForm").serialize(),
success: function(){
window.location.href = "'.JURI::root().'index.php?option=com_virtuemart&view=category&virtuemart_category_id='.JRequest::getVar('virtuemart_category_id','').'";
},
error: function(jqXHR, textStatus){
$("#vm_preloader").hide();
alert("textStatus = " + textStatus + "  Code = " + jqXHR.status);
}
});
});
             $("#toolbar-cancel a").click(function(){
window.location.href = "'.JURI::root().'index.php?option=com_virtuemart&view=category&virtuemart_category_id='.JRequest::getVar('virtuemart_category_id','').'";
            });
})';
$document->addScriptDeclaration ( $j);

end
$html .= '<a class="toolbar" onclick="Joomla.submitbutton(\'save\')" ><span class="icon-32-save"> </span>'.jText::_('COM_VIRTUEMART_SAVE').'</a>';
to replace on
$html .= '<a class="toolbar"><span class="icon-32-save"> </span>'.jText::_('COM_VIRTUEMART_SAVE').'</a>';
end
$html .= '<a class="toolbar" onclick="Joomla.submitbutton(\'cancel\')" ><span class="icon-32-cancel"> </span>'.jText::_('COM_VIRTUEMART_CANCEL').'</a>';
to replace on
$html .= '<a class="toolbar"" ><span class="icon-32-cancel"> </span>'.jText::_('COM_VIRTUEMART_CANCEL').'</a>';

So after saving (or canceling) we will go to category the product from which just edited.