1

I want to somehow get the product id from j2store and display the main image of each product in the article section each product.

In /templates/namira/html/com_content/article/default.php there are lines of codes which allow to display some content of the j2store product.

<div itemprop="articleBody">
    <?php echo $this->item->text; ?>
</div>

But how to alter this code to include also the main image of the product? something like:

echo $this->product->j2store_product_id; 

I want to include the j2store product class.

1
  • Welcome to JSE, please take our tour. Jun 19, 2021 at 22:53

1 Answer 1

0
require_once(JPATH_ADMINISTRATOR.'/components/com_j2store/helpers/j2store.php');
$product = F0FTable::getAnInstance('Product', 'J2StoreTable')->getClone();
if($product->get_product_by_source('com_content', $this->item->id)) {
        //return what you want for example      
        echo $product->j2store_product_id;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.