Post by ajemptage1 » Thu Jul 19, 2018 3:21 am

Hi there!
I am fairly new to setting up MVC systems so I'm a little lost on where to begin on this.

I've got an OpenCart 2.3 installation with two stores set up and I need to pull in the product data below from products within one particular category on the primary store, to be called in an HTML module placed on the product pages of the secondary store.

I know it's probably an odd request, and I sincerely apologize for having very literally nothing to start with on the model or controller files. I am not looking for someone to do it for me, just to point me in the right direction.
I assume that the specific category could be selected in the HTML module itself with something along the lines of <?php if ($product['category'] == 'XXX') { ?>, but how do I go about actually pulling that data into the page to be used?

Here is the code chunk I'll be using on the secondary store pages:

Code: Select all

<?php foreach ($[b]PRODUCTFROMSPECIFICCATEGORY [/b]as $product) { ?>
<div class="paint-product-panel" id="<?php echo $model; ?>">
	<img src="<?php echo $image['thumb']; ?>">
	<h4><?php echo $heading_title; ?></h4>
  <p><?php echo $short_desc; ?></p>
  <?php foreach ($options as $option) { ?>
  <?php if ($option['type'] == 'select') { ?>
  <?php if ($option['name'] == 'Quarts') || ($option['name'] != 'Gallons') { ?>
  <div class="form-group">
  	<label class="control-label" for="input-option<?php echo $option['product_option_id']; ?>"><?php echo $option['name']; ?></label>
  	<select name="option[<?php echo $option['product_option_id']; ?>]" id="<?php echo $model; ?>-<?php echo $option['name']; ?>" class="form-control" style="font-size: 18px; display: inline-block; width: auto; height: auto;">
        <?php foreach ($option['product_option_value'] as $option_value) { ?>
        <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?></option><?php } ?>
    </select>
  </div>
  <?php } ?>
  <?php } ?>
  <?php } ?>
</div>
<?php ]?>

Newbie

Posts

Joined
Tue Mar 13, 2018 8:43 pm

Post by straightlight » Thu Jul 19, 2018 6:25 pm

Limited information posted.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ajemptage1 » Thu Jul 19, 2018 9:00 pm

To put it simply, I need to know how to pull product data from one store into another store's product/product.tpl sharing the same back-end.

Newbie

Posts

Joined
Tue Mar 13, 2018 8:43 pm

Post by straightlight » Thu Jul 19, 2018 10:46 pm

The use of an API would be ideal in this case if two separate stores needs to share different products on the same pages. An example with this post: viewtopic.php?f=191&t=203344&p=719531#p719531 . All you'd need to do is to target the products instead of the rewards. With a little bit of tweaking in the codes, this can be achieved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ajemptage1 » Sat Jul 21, 2018 1:03 am

straightlight wrote:
Thu Jul 19, 2018 10:46 pm
The use of an API would be ideal in this case if two separate stores needs to share different products on the same pages. An example with this post: viewtopic.php?f=191&t=203344&p=719531#p719531 . All you'd need to do is to target the products instead of the rewards. With a little bit of tweaking in the codes, this can be achieved.
Thank you very much for your suggestion, I'm not sure I understand what I'm looking at there fully. How would I use that method to pull in product data?
Sorry for not grasping this, I really do appreciate your input!

Newbie

Posts

Joined
Tue Mar 13, 2018 8:43 pm

Post by straightlight » Sat Jul 21, 2018 3:50 am

No problem. You can always create a new service request in the Commercial Support section of the forum to get this done as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 45 guests