News:

Looking for documentation? Take a look on our wiki

Main Menu

[SOLVED] Short description with WYSIWYG and HTML - possible?

Started by Razva, September 27, 2011, 10:06:25 AM

Previous topic - Next topic

Razva

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

The short description does not allow to use html? I wonder, please try if you can add manually html code
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


Razva

Quote from: Milbo 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 did, it doesn't...else I wouldn't opened this topic... :) Any HTML code is removed after saving the product.

Quote from: zarisko on September 27, 2011, 15:14:18 PM
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

sorry i didn't realise it was a VM2 topic.

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

PRO

#5
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.


PRO

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

Razva

Quote from: BanquetTables.pro 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.
Yup, WYSIWYG appeared!

Quote from: BanquetTables.pro 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

Defined:

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
Fatal error: Cannot redeclare VirtuemartControllerProduct::save() in /home/semineem/public_html/administrator/components/com_virtuemart/controllers/product.php on line 124
when accesing Joomla Admin -> Virtuemart -> Products

How can I fix this please? Thanks a lot!

PRO

#8
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.

Razva

Defined "function save2()". Now the editor opens but, even if I just bold something, it doesn't saves (the modification disappears after Save).

PRO

yes, I just tried it. I would wait for milbo to respond. He might wanna add this.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

Great! Thanks a lot! :)

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

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

#14
I suppose that we're talking about
Quotehttps://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 :)