Jump to content

Display Featured Product Feed on another site


Imajica929
 Share

Recommended Posts

Afternoon Folks,

 

I am working on a new cubecart site that has an accompanying blog and I'd like to display the contents of the Featured Product box in he sidebar of the blog site

Does anyone know how to pull that off?

 

John

 

Edited by Imajica929
clarity
Link to comment
Share on other sites

Welcome Imajica929! Glad to see you made it to the forums.

CubeCart does not have an externally accessible API that would return this data, but one could be built.

We would have to assume that you already have the capability and skill to write the blog's request and consume the returned data.

On the other hand, if you can convince the blog to access CubeCart's database directly, all the pertinent data could be queried independently.

 

Edited by bsmither
Link to comment
Share on other sites

CubeCart's "Featured" is actually a random pick from all products whose featured flag is set. Modify the following query to have the database engine pick one random record -or- only have set one product's Featured setting checkbox to a checked state.

SELECT * FROM `CubeCart_inventory` WHERE CubeCart_inventory.status = '1' AND CubeCart_inventory.featured = '1';

Take note of the 'product_id' of the returned row. Use it in the next two queries.

SELECT `path` FROM `CubeCart_seo_urls` WHERE CubeCart_seo_urls.type = 'prod' AND CubeCart_seo_urls.item_id = $product_id;
SELECT `file_id` FROM `CubeCart_image_index` WHERE CubeCart_image_index.product_id = $product_id ORDER BY `main_img` DESC LIMIT 1;

Take note of the 'file_id' of the returned row. Use it in the next query.

SELECT `filepath`, `filename` FROM CubeCart_filemanager WHERE CubeCart_filemanager.file_id = $file_id;

Use 'filepath' and 'filename' to construct an <img> tag for the product's image.

Use 'path' to construct a web address to the product in the CubeCart store.

 

  • Like 1
Link to comment
Share on other sites

I'll admit it.. I cheated.. a lot

I made a copy of index.php and changed the display to 'templates/box.featured.php'

I can run that in a iframe or call it from an include with some additional massaging

 

I'll play with the database method after we go live and I have a little more time :)

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...