Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // No direct access
- defined('_JEXEC' ) or die('Restricted access');
- $app = JFactory::getApplication();
- $id = $app->input->getInt('id');
- // get product
- $product = F0FTable::getAnInstance('Product', 'J2StoreTable')->getClone();
- // get product variant
- $variant = F0FTable::getAnInstance('Variant','J2StoreTable');
- $variant->load(array('product_id' => $id));
- // get article
- $article = JTable::getInstance('content');
- // ARTICLE ID IS NOT ALWAYS EQUAL TO PRODUCT ID, DEPENDS IF WE ARE IN COM_CONTENT OR COM_J2STORE
- $article->load($id);
- if($product->get_product_by_source('com_content', $id)) {
- // get data from #__j2store_products table (main_image, thumb_image, additional_images, up_sells, cross_sells, manufacturer)
- echo $product->main_image;
- // get data from #__j2store_variants table (sku, price, dimensions...)
- echo $variant->sku;
- // get data from #__com_content table
- echo $article->get('title');
- }
Add Comment
Please, Sign In to add comment