Stock display on product listing

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #76663

Hi,

is it possible to get STOCK displaying away from product listing but leave it on product page?
Thanx!

Please Log in or Create an account to join the conversation.

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #76835

Hi,

You can edit the view "product show" and add find this code at the beginning of the file

if (empty ($this->element)) {
  $app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND');
} else {
And add one line just after, like that:
if (empty ($this->element)) {
  $app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND');
} else {
  $this->element->product_quantity = -1;
At this moment, the quantity would be a fake "unlimited" so the stock block won't be displayed.
But there is a side effect : the javascript script which alert the user for the stock won't be added in the page.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 5 months ago by Jerome. Reason: fix code

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #76914

thank you for respons!

I did as you said and got rid of stock on product page. On product listing displays stock as it was before.

I'm sorry to say that, but my wish is vice versa - out from product listing, leave it on product page :)

Please Log in or Create an account to join the conversation.

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #76981

Hi,

Oh sorry, it was the inverse. I misunderstood your request !
Well, the modification is the same but for another file.
First, revert your modification in the "product show" view.
Edit the "product listing" view and add this code.

if(!empty($this->rows)) {
  foreach($this->rows as &$row){
    $row->product_quantity = -1;
  }
  unset($row);
}
It would modify the quantity for every product in the current list.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 5 months ago by Jerome. Reason: fix code

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #77044

:)

but as beeing amateur I'm not sure where to place this code within file.
I tried to place at many places inside the file but every time I got only broken page... :blush:

can you please advise?

Please Log in or Create an account to join the conversation.

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #77109

Hi,

You should have at the beginning of the file

<?php
if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) {?>
You can put the PHP code there
<?php
if(!empty($this->rows)) {
  foreach($this->rows as &$row){
    $row->product_quantity = -1;
  }
  unset($row);
}
if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) {?>

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 5 months ago by Jerome. Reason: fix code

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #77131

hmmm, it looks slightly different. The proposed code was placed rigth down here where HERE is written. Unfortunately broken page afterwards.


<?php

HERE

/**
* @package HikaShop for Joomla!
* @version 2.0.0
* @author hikashop.com
* @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/

defined('_JEXEC') or die('Restricted access');
?><?php

HERE

if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) {?>

HERE

<script type="text/javascript">

Please Log in or Create an account to join the conversation.

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #77136

Hi,

The second one:
?><?php

HERE

if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) {?>

Best regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #77138

with that code:

?><?php

if(!empty($this->rows) {
foreach($this->rows as &$row){
$row->product_quantity = -1;
}
unset($row);
}
if(hikashop_level(2) && JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) {?>


I got:

Parse error: syntax error, unexpected '{' in /home/greenros/public_html/templates/bt_bazaar/html/com_hikashop/product/listing.php on line 13

Please Log in or Create an account to join the conversation.

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #77146

Sorry, my fault !

There was a missing parentheses:
if(!empty($this->rows)) {

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Batas

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
11 years 5 months ago #77147

brilliant support! :)

thanks a lot!

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum