Guest User

Untitled

a guest
Jan 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. // No direct access
  4. defined('_JEXEC' ) or die('Restricted access');
  5.  
  6. $app = JFactory::getApplication();
  7. $id = $app->input->getInt('id');
  8. // get product
  9. $product = F0FTable::getAnInstance('Product', 'J2StoreTable')->getClone();
  10. // get product variant
  11. $variant = F0FTable::getAnInstance('Variant','J2StoreTable');
  12. $variant->load(array('product_id' => $id));
  13. // get article
  14. $article = JTable::getInstance('content');
  15.  
  16. // ARTICLE ID IS NOT ALWAYS EQUAL TO PRODUCT ID, DEPENDS IF WE ARE IN COM_CONTENT OR COM_J2STORE
  17. $article->load($id);
  18.  
  19. if($product->get_product_by_source('com_content', $id)) {
  20. // get data from #__j2store_products table (main_image, thumb_image, additional_images, up_sells, cross_sells, manufacturer)
  21. echo $product->main_image;
  22. // get data from #__j2store_variants table (sku, price, dimensions...)
  23. echo $variant->sku;
  24. // get data from #__com_content table
  25. echo $article->get('title');
  26. }
Add Comment
Please, Sign In to add comment