Jump to content
Sign in to follow this  

how to change the php code to work on product page?

Recommended Posts

    $handle = fopen('https://www.example.com/', 'r');
    $content = '';
        $content .= fread($handle, 8080);
    echo $content;

Share this post

Link to post
Share on other sites

Would you be willing to have the browser bring it in either as an iframe, or as an ajax request?

An iframe will need to have a header issued by CubeCart be removed ("SAMEORIGIN"), and the page being requested undoubtedly is a complete web document, well suited to be in an iframe.

An ajax request may need to be processed to crop away all that is not in the <body> tags.

The product's description is databased and is a value of the product's details array. Once you have the description in the array held in memory, you can add more to it, or replace a {PLACEHOLDER} with $content.

CubeCart also has hooks that can be used to modify details like this without making changes to the code.

I think a hook is the best way to go, but be sure that your hosting provider has set PHP's ' allow_url_fopen ' to enabled.

You might also think to use PHP's 'file_get_contents'.

There is also CubeCart's Request class which is specifically built to get stuff from off-site.

Share this post

Link to post
Share on other sites

Your details above suggest that the incoming data is static. Meaning, you will not be wanting to include any info in the request to specify a particular response.

Is this correct?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this