Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Display External Php Script On Products Page Tab Rate Topic   - - - - -

  • ryansc
  • Newbie
  • Members
  • Join Date: 17-Dec 15
  • 2 posts

Posted 27 July 2018 - 05:04 PM #1



Using CS-Cart 4.8.1, I would like the ability have a tab on the products page display content from an external php script located in the httpdocs root folder. path: domain.com/script.php 


It seems the newer versions of CS-Cart no longer support php code in an HTML block with Smarty support. In older versions of CS-Cart I would simply use the {php} tag which allowed PHP code to be embedded directly into the template. 


Would this need to be an add-on or is there an more simple workaround to get php code to execute in an HTML block? Even file_get_contents would work if I could simply get the php to execute.


Thanks for the help!


  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11180 posts

Posted 27 July 2018 - 06:39 PM #2

You will need to do this with javascript via an ajax request to the script and then have (or create) a container to put the output in.  Note that there are security implications to this so assume that your script is handling that.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.

  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 18798 posts

Posted 30 July 2018 - 05:57 AM #3

Use HTML block with SMARTY support and the following code

{$response = "https://domain.com"|file_get_contents}
{if $response}
    {$response nofilter}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.