Page 1 of 1
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Sat Dec 07, 2019 5:09 pm
by xxvirusxx
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>
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Wed Dec 25, 2019 5:48 am
by belowcost
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
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Mon Dec 30, 2019 7:39 pm
by mitrecyclers
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.
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Tue Dec 31, 2019 6:57 pm
by mitrecyclers
Any advice please? Don't have tpl files, just twig files
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Tue Dec 31, 2019 7:29 pm
by thekrotek
mitrecyclers wrote: ↑Tue Dec 31, 2019 6:57 pm
Any advice please? Don't have tpl files, just twig files
Then edit .twig file.
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Tue Dec 31, 2019 8:14 pm
by xxvirusxx
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

)
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>
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Fri Jan 03, 2020 1:47 am
by mitrecyclers
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.
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Fri Jan 03, 2020 2:16 am
by xxvirusxx
Then add where you want...after product name, product price, product description...
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Fri Jan 03, 2020 7:48 am
by mitrecyclers
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
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Fri Jan 03, 2020 8:24 am
by IP_CAM
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Sat Jan 04, 2020 1:15 am
by mitrecyclers
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?
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Sun Jan 05, 2020 4:38 pm
by xxvirusxx
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"
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Tue Jan 07, 2020 11:01 pm
by mitrecyclers
Should I post as new forum topic or you think you can guide me here? I really appreciate that.
Re: DISPLAY STOCK QUANTITY ON SEARCH RESULTS PAGE
Posted: Wed Jan 08, 2020 12:30 am
by opencartboost
For other page like, manufacturer, special and category.
Open file :
catalog/controller/product/
special.php
Find :
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