Post by xxvirusxx » Sat Dec 07, 2019 5:09 pm

Just edit: catalog/controller/product/search.php

Search $this->data['products'][] = array( and below add:

Code: Select all

'quantity'    => $result['quantity'],
Then edit catalog/view/theme/default/template/product/search.tpl and you can add after

Code: Select all

<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
This line:

Code: Select all

<div>Product quantity: <?php echo $product['quantity']; ?></div>

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by belowcost » Wed Dec 25, 2019 5:48 am

On search results or category display page, how can you add the PART NUMBER so it displays on the results?

And how can you make the text from the product page not continuously wrap and continue? If the product page has a new line, then wrap the new line.

A bullet display as a bullet, and not just text?

http://belowcost.net/belowcost/index.ph ... arch=combo

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by mitrecyclers » Mon Dec 30, 2019 7:39 pm

xxvirusxx wrote:
Sat Dec 07, 2019 5:09 pm
Just edit: catalog/controller/product/search.php

Search $this->data['products'][] = array( and below add:

Code: Select all

'quantity'    => $result['quantity'],
Then edit catalog/view/theme/default/template/product/search.tpl and you can add after

Code: Select all

<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
This line:

Code: Select all

<div>Product quantity: <?php echo $product['quantity']; ?></div>

Thanks. I edited the search.php file but I don't have search.tpl file. I do have search.twig file instead. Can you please help me how to edit twig files to achieve product qty on main page? I appreciate that. Thanks.

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by mitrecyclers » Tue Dec 31, 2019 6:57 pm

Any advice please? Don't have tpl files, just twig files

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by thekrotek » Tue Dec 31, 2019 7:29 pm

mitrecyclers wrote:
Tue Dec 31, 2019 6:57 pm
Any advice please? Don't have tpl files, just twig files
Then edit .twig file.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by xxvirusxx » Tue Dec 31, 2019 8:14 pm

mitrecyclers wrote:
Tue Dec 31, 2019 6:57 pm
Any advice please? Don't have tpl files, just twig files
Yes. Next time stop posting on old version forum...when you have a new version of Opencart.
That solution provided because you have posted on Opencart 1.5.x forum...
Now was moved to 3.0.....but messages wasn't splited...1.5.x to 1.5.x and 3.x to 3.x (bad mods :laugh: )
xxvirusxx wrote:
Sat Dec 07, 2019 5:09 pm
Just edit: catalog/controller/product/search.php

Search $data['products'][] = array( and below add:

Code: Select all

'quantity'    => $result['quantity'],
Then edit catalog/view/theme/default/template/product/search.twig and you can add after

Code: Select all

<div class="name"><a href="{{ product.href }}">{{ product.name }}</a></div>
This line:

Code: Select all

<div>Product quantity: {{ product.quantity }}</div>

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mitrecyclers » Fri Jan 03, 2020 1:47 am

Thanks. Sorry I didn't realised I was posting in wrong forum, probably done it via phone and unable to see which forum I am posting.

I don't have this line
<div class="name"><a href="{{ product.href }}">{{ product.name }}</a></div>

nearest I have is

<div class="caption">
<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>

But adding product.quantity after this makes no difference.

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by xxvirusxx » Fri Jan 03, 2020 2:16 am

Then add where you want...after product name, product price, product description...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mitrecyclers » Fri Jan 03, 2020 7:48 am

I did but no effect and it still does not shows available qty on main page. Only when i click product it shows.

you can see at

https://mitrecyclers.com/APPLE%20IPHONE ... Grade%20AB

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by IP_CAM » Fri Jan 03, 2020 8:24 am

Image

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mitrecyclers » Sat Jan 04, 2020 1:15 am

Thanks for your help. I found mistake. I was looking in just general browsing. When I click category or on home page, But it is showing this only in Search result. Is it possible to achieve same result in other pages as well?

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by xxvirusxx » Sun Jan 05, 2020 4:38 pm

mitrecyclers wrote:
Sat Jan 04, 2020 1:15 am
But it is showing this only in Search result.
Yes, because post title is "DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE"

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mitrecyclers » Tue Jan 07, 2020 11:01 pm

Should I post as new forum topic or you think you can guide me here? I really appreciate that.

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by opencartboost » Wed Jan 08, 2020 12:30 am

For other page like, manufacturer, special and category.
Open file :
catalog/controller/product/special.php
Find :

Code: Select all

$data['products'][] = array( 
Add after:

Code: Select all

'quantity'    => $result['quantity'],
Open file
catalog/view/theme/default/template/product/special.twig
Find :

Code: Select all

<div class="name"><a href="{{ product.href }}">{{ product.name }}</a></div>
Add after :

Code: Select all

<div>Product quantity: {{ product.quantity }}</div>
Do the same step for other page like manufacturer, category
catalog/controller/product/manufacturer.php
catalog/view/theme/default/template/product/manufacturer.twig
catalog/controller/product/category.php
catalog/view/theme/default/template/product/category.twig

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am
Who is online

Users browsing this forum: No registered users and 422 guests