Author Topic: [SOLVED] Short description with WYSIWYG and HTML - possible?  (Read 15175 times)

Razva

  • Jr. Member
  • **
  • Posts: 55
[SOLVED] Short description with WYSIWYG and HTML - possible?
« on: September 27, 2011, 10:06:25 am »
Hi,

Please take a look at http://www.semineemures.ro/produse/accesorii/demo-1/Idro-50-1

As you can see, on the right side there's the short description, and under the image there's the "long description".

The problem is that the short description doesn't supports WYSIWYG or HTML.

We would like to insert formatted text/WYSIWYG  both in the description, which is ok right now, PLUS on the right side, where we have the short description right now.

Is there any way to activate formatted text/html/WYSIWYG for the short description? Or can we define a new field/secondary description? How can we accomplish that?

Thanks!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9838
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Second product description - possible?
« Reply #1 on: September 27, 2011, 15:01:58 pm »
The short description does not allow to use html? I wonder, please try if you can add manually html code
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

zarisko

  • Beginner
  • *
  • Posts: 13

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: Second product description - possible?
« Reply #3 on: September 27, 2011, 16:44:05 pm »
The short description does not allow to use html? I wonder, please try if you can add manually html code
I did, it doesn't...else I wouldn't opened this topic... :) Any HTML code is removed after saving the product.

You could also add the editor
That folder/file doesn't exists in V2. <?php echo $db->sf("product_s_desc"); ?> doesn't exists in any file...

zarisko

  • Beginner
  • *
  • Posts: 13
Re: Second product description - possible?
« Reply #4 on: September 27, 2011, 18:53:38 pm »
sorry i didn't realise it was a VM2 topic.

but maybe the solution is the same, just different folder/file paths.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10328
  • VirtueMart Version: 3+
Re: Second product description - possible?
« Reply #5 on: September 27, 2011, 19:51:48 pm »
administrator/components?com_virtuemart/views/product_edit_description.php

Change this
<textarea class="inputbox" name="product_s_desc" id="short_desc" cols="65" rows="3" ><?php echo $this->product->product_s_desc; ?></textarea>

To this
<?php echo $this->editor->display('product_s_desc',  $this->product->product_s_desc, '100%;', '550', '75', '20', array('pagebreak', 'readmore') ) ; ?>

then see what happens. The database field should allow it. BUT there might be a function stripping it.


JUST tested it, and it does strip the field of html.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10328
  • VirtueMart Version: 3+
Re: Second product description - possible?
« Reply #6 on: September 27, 2011, 20:03:38 pm »
there is a function to allow html in product_desc
administrator/virtuemart/controllers  product.php


function save(){

      $product_desc = JRequest::getVar('product_desc','','post','STRING',JREQUEST_ALLOWRAW);
 $data = JRequest::get('post');
 $data['product_desc'] = $product_desc;
//       vmdebug('my data in product save ',$data);
      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',JREQUEST_ALLOWHTML);
         $data['product_desc'] = JRequest::getVar('product_desc','','post','STRING',2);
      }

      parent::save($data);
   }

I believe you can use the same for product_s_desc
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: Second product description - possible?
« Reply #7 on: September 27, 2011, 20:21:47 pm »
administrator/components?com_virtuemart/views/product_edit_description.php

Change this
<textarea class="inputbox" name="product_s_desc" id="short_desc" cols="65" rows="3" ><?php echo $this->product->product_s_desc; ?></textarea>

To this
<?php echo $this->editor->display('product_s_desc',  $this->product->product_s_desc, '100%;', '550', '75', '20', array('pagebreak', 'readmore') ) ; ?>

then see what happens. The database field should allow it. BUT there might be a function stripping it.
Yup, WYSIWYG appeared!

there is a function to allow html in product_desc
administrator/virtuemart/controllers  product.php


function save(){

      $product_desc = JRequest::getVar('product_desc','','post','STRING',JREQUEST_ALLOWRAW);
 $data = JRequest::get('post');
 $data['product_desc'] = $product_desc;
//       vmdebug('my data in product save ',$data);
      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',JREQUEST_ALLOWHTML);
         $data['product_desc'] = JRequest::getVar('product_desc','','post','STRING',2);
      }

      parent::save($data);
   }

I believe you can use the same for product_s_desc

Defined:

Code: [Select]
function save(){

      $product_s_desc = JRequest::getVar('product_s_desc','','post','STRING',JREQUEST_ALLOWRAW);
 $data = JRequest::get('post');
 $data['product_s_desc'] = $product_s_desc;
//       vmdebug('my data in product save ',$data);
      if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
      if(Permissions::getInstance()->check('admin')){
//          $data['product_s_desc'] = JRequest::getVar('product_s_desc','','post','STRING',JREQUEST_ALLOWHTML);
         $data['product_s_desc'] = JRequest::getVar('product_s_desc','','post','STRING',2);
      }

      parent::save($data);
   }

After saving the product I get
Code: [Select]
Fatal error: Cannot redeclare VirtuemartControllerProduct::save() in /home/semineem/public_html/administrator/components/com_virtuemart/controllers/product.php on line 124when accesing Joomla Admin -> Virtuemart -> Products

How can I fix this please? Thanks a lot!

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10328
  • VirtueMart Version: 3+
Re: Second product description - possible?
« Reply #8 on: September 27, 2011, 20:29:33 pm »
edit, tried that and it still stripped

BUT: I believe this might be added to the core. I would wait for milbo to respond. Some users will want this.
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: Second product description - possible?
« Reply #9 on: September 27, 2011, 20:33:29 pm »
Defined "function save2()". Now the editor opens but, even if I just bold something, it doesn't saves (the modification disappears after Save).

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10328
  • VirtueMart Version: 3+
Re: Second product description - possible?
« Reply #10 on: September 27, 2011, 20:36:24 pm »
yes, I just tried it. I would wait for milbo to respond. He might wanna add this.
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9838
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Second product description - possible?
« Reply #11 on: September 27, 2011, 23:21:29 pm »
I add the right filter.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: Second product description - possible?
« Reply #12 on: September 27, 2011, 23:23:09 pm »
Great! Thanks a lot! :)

Just please don't forget to tell us the name of the updated file/s.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9838
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Second product description - possible?
« Reply #13 on: September 27, 2011, 23:29:49 pm »
it is only the controller
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: Second product description - possible?
« Reply #14 on: September 27, 2011, 23:34:31 pm »
I suppose that we're talking about
Quote
https://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart/administrator/components/com_virtuemart/controllers/product.php

NOTE: when replying this message the option didn't functioned, but I suppose we should wait till Milbo makes his magic :)