News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Cannot save edited product from frontend on VM2.0.8-2.0.10 J1.5.26

Started by bony599, September 24, 2012, 15:43:39 PM

Previous topic - Next topic

bony599

The product saving 'save' task from frontend looked as the product 'cancel' task with redirecting to the frontend index.php until I patched few VM files:
vmview.php - function getToolbar (fragment):

//and make whatever calls you require
      //Bony599 start $bar->appendButton( 'Standard', 'save', 'Save', 'save', false );
      $html='<a href="javascript: void(0)" onclick="javascript: submitbutton(\'save\')" class="toolbar">'.
            '<span class="icon-32-save" title="'.JText::_('Save').'">'.
            JText::_('Save').'</span></a>';
      $bar->appendButton( 'Custom', $html);
      $bar->appendButton( 'Separator' );
      $html='<a href="javascript: void(0)" onclick="javascript: submitbutton(\'cancel\')" class="toolbar">'.
            '<span class="icon-32-save" title="'.JText::_('Cancel').'">'.
            JText::_('Cancel').'</span></a>';
      $bar->appendButton( 'Custom', $html);
      //Bony599 end $bar->appendButton( 'Standard', 'cancel', 'Cancel', 'cancel', false );
      //generate the html and return
      return $bar->render(); 


virtuemart.php (fragment):

vmdebug("com_virtuemart: _controller=$_controller task=$task ".!$task); //bony599
   if (($_controller == 'product' || $_controller == 'category') ) { //bony599
      $app = JFactory::getApplication();

      if ($task == 'save' || $task == 'edit') { //bony599
         if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
         if   (Permissions::getInstance()->check("admin,storeadmin")) {
            $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, null, true);
            $basePath = JPATH_VM_ADMINISTRATOR;
            $trigger = 'onVmAdminController';
         } else {
            $app->redirect('index.php?option=com_virtuemart', jText::_('COM_VIRTUEMART_RESTRICTED_ACCESS') );
         }
      }
      else { //bony599
          vmdebug('redirect '.'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.JRequest::getInt('virtuemart_product_id') ); //bony599
          $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.JRequest::getInt('virtuemart_product_id') )); //bony599
       }

   } elseif($_controller) {
         $basePath = JPATH_VM_SITE;
   }
 

   
controller product.php (fragment):

   function save($data = 0){
vmdebug('product_controller_save redirectPath='.$this->redirectPath.' isSite='.JFactory::getApplication()->isSite()); //bony599
      $data = JRequest::get('post');

      if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
      if(Permissions::getInstance()->check('admin')){
         $data['product_desc'] = JRequest::getVar('product_desc','','post','STRING',2);
         $data['product_s_desc'] = JRequest::getVar('product_s_desc','','post','STRING',2);
      }
      $virtuemart_product_id=JRequest::getInt('virtuemart_product_id'); //bony599
        if(JFactory::getApplication()->isSite() && $virtuemart_product_id) $this->redirectPath .= '&virtuemart_product_id=' . $virtuemart_product_id; //bony599
      parent::save($data);
   }
 

   

SEF URL in view productdetails (fragment of view.html.php):

       $edit_link = JRoute::_('index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id . '&tmpl=component'); //bony599
 
   

You may include these patches in new release.

bytelord

Hello,

Frontend Editing will be available on the next release (probably 2.0.12). Take a look here: http://forum.virtuemart.net/index.php?topic=107541.0
For now you can test 2.0.11d and report issues or bugs on the forum

Regards.
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

un10cked

Hi,

Does this work for 2.0.12. I would like to give it a try. Cheers,

bytelord

Hello,

It is working in 2.0.12, you can try with a test installation to see the new features and test your template overrides.
http://virtuemart.net/news/list-all-news/426-end-of-life-for-virtuemart-11-heidelpay-now-in-virtuemart-2012

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!