NoNumber Sorcerer not working in description field

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #193457

-- HikaShop version -- : 2.3.0
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.36
-- Browser(s) name and version -- : Chrome 40.0.2214.115 m

Our client has a joomla 2.5 site running HikaShop 2.35. which has NoNumber sorcerer installed. The HikaShop products description fields have this script embedded

{source} [[?php require_once JPATH_SITE.'/customcontent/cp_desc.php'; $desc = cp_description("SS"); echo $desc; ?]]{/source} {source}[[?php require_once JPATH_SITE.'/customcontent/mp_desc.php'; $desc = mp_description("HPT"); echo $desc; ?]]{/source} {source}[[?php require_once JPATH_SITE.'/customcontent/sizing.php'; $tbl = sizingtable("Stockman Short Shank Happy Tongue",0,0); echo $tbl; ?]] {/source}
in them here is the link to the live site.

I have tried to replicate it on the new J3 site we developing but cannot get it to work as it is showing the script on the front end. The closest i have gotten is showing an expanded description field but it is blank and no script showing on the front end and i used a Joomla plugin called DirectPHP to achieve this.

Have i missed something or is it not possible to achieve?

Your help would be greatly appreciated Hika community!

Thanks

Last edit: 9 years 8 months ago by Oneplanet.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #193471

Hi,

In the view "product / show_default" the code displaying the description is:

echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
So as you can see we are doing a "content.prepare" which allow to the tags in the content to be executed by the plugins.

It should be working, please check your plugin settings, if it is well set, published, etc.

Else, you could potentially edit the view "show_default" and do the tag replacement yourself.

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #193786

Hi Xavier

Thanks for the response. There is not much to configure in the Sorcerer plugin as i am using the free and only have the option to configure 3 default settings. The rest are only available in the PRO version. Also unfortunately I am not a coder so editing the view would be a greater task for me.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 2143
  • Thank you received: 747
9 years 8 months ago #193810

Hi,

I hope I'm not wasting anyone's time, but I'm stumbling over some oddity in your PHP code/syntax in between the Sourcerer tags:
Your initial post shows the code like this:

{source} [[?php .............. ?]] {/source}

But AFAIK it should be like this - just like regular PHP syntax:
{source}<?php .............. ?>{/source}

Maybe try that?


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Last edit: 9 years 8 months ago by lousyfool.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 8 months ago #193795

Hi,

If the sourcerer code is not replaced on the frontend, it is something with the sourcerer plugin. Either its settings or in its code.
It's likely to be something with its settings. Like for example if the access of the plugin is not "public". So please check that.

Alternatively, the PHP code you're trying to insert in the product description sounds quite simple and just adding it to the file "show_default" as Xavier explained should do the trick. You can for example just add it after the line displaying the product description.

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #193998

Hi guys

@ Lousyfool - I have tried that but it didnt work, thanks for the help tho :)

@nicolas - I have the free version of sorcerer so only have 3 basic settings available to me which are to allow CSS, Javascript and PHP with these being the forbidden PHP functions

dl, escapeshellarg, escapeshellcmd, exec, passthru, popen, proc_close, proc_open, shell_exec, symlink, system
The plugin is enabled and has public access.

It seems my only option is to add the custom description php to the "show_default" view but i have a query about that. Each product has its own unique description code, would i have to add each one to the view?

Thanks again for your help so far!

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 8 months ago #194026

Hi,

No, you can directly use the product code in that view file:

<?php echo $this->element->product_code; ?>

The following user(s) said Thank You: Oneplanet

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #194241

So would i have to add every product code to that one view file? or does every product have its own view file?

Sorry im battling to grasp this for some reason....Sigh!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #194249

Hi,

Every product is using the same view file, but the code given by Nicolas will get dynamically the product code, so you just have to use that code one time and it will display a different value for each products.

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #194920

So i have added the code from Nicolas to my show_default.php file and nothing has changed.

Am i meant to edit the script that i put into the product description in Hikashop or replace the original description code in the show_default_.php with the code from Nicolas?

Below is the code from my show_default.php file so you can see were i am at with this.

<div id="hikashop_product_description_main" class="hikashop_product_description_main">
		<?php
		echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
		?><?php echo $this->element->product_code; ?>
	</div>

Again thanks for your help!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #194946

Hi,

That code should display the product code after the description of the product.
If nothing has changed, please be sure that you are editing the correct view in the correct template.

The following user(s) said Thank You: Oneplanet

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 0
9 years 8 months ago #195093

Yes it is working! The reason the descriptions are not showing on the front end is that the module showing is not Hikashop module and is not controlled by a Hikashop view. It is a "SJ Slideshow for Hikashop" ....

Thanks again Nicolas and Xavier for the great help.

Cheers

Please Log in or Create an account to join the conversation.

Time to create page: 0.096 seconds
Powered by Kunena Forum