Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 06-30-2010 03:30:27

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

If an Item Sold, Set to "Not Viewable by Anyone"

Hello Guys,

Is it possible to to make an item appear as "Not Viewable by Anyone" once one is sold.

i am guessing i have to modify some scripting and enable inventory levels, but not sure where to start.

Thanks in advance.

Daniel Smith

Offline

 

#2 06-30-2010 12:41:42

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

You could do this, but would you actually want to?

If I was a customer who'd visited a site, seen an item and thought "maybe I'd like to buy that", but when I come back it's not just "out of stock" but completely vanished, I'd think there was a fault in the site.

Of course if it's because the item for sale is a one-off or custom product then provided you included a message saying this, it would be ok.

I'm not sure how you'd do the coding you want, but I'd suggest looking for where it decides whether to print the stock level or "out of stock" message and use that to intercept the listing of an item such that if stock level is zero it skips over the "print item details" routine.

Last edited by Graham (06-30-2010 12:43:17)

Offline

 

#3 07-01-2010 04:14:07

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

HI Graham,

Yeah the products are one off custom products, do you know where i would have to do this?

Thanks

Offline

 

#4 07-01-2010 08:30:53

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Sorry, I don't know where in the code you'd find what you need.

Offline

 

#5 07-01-2010 09:05:15

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

You would want the make mods to the ECOM_Order/ext/0000_status.php script, which is the script that handles inventory updates and other actions when an order is completed, or create  you own script to handle the update to be placed in the same location.

John

Offline

 

#6 07-16-2010 04:34:07

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

HI John,

Do you know where abouts and what to edit.

Thanks mate

Offline

 

#7 07-16-2010 08:48:28

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

dansmith490 wrote:

HI John,

Do you know where abouts and what to edit.

Thanks mate

That file can be found here-
core-private/apps/ecom/ECOM_Order/ext/0000_status.php

I think the "0300_inventory.php" file in the same directory might be of help as well.

Offline

 

#8 07-16-2010 09:12:17

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

I have this code, in the 0300_inventory file, but i have not modified the 0000_status file. am i right in thinking the item will only be removed once the item is sold and the order is set to complete?

Code:

      if (!(empty($result))) {

          foreach ($result as $num => $row) {

               $inv = $row['inventory'] - $cartinv_opt[$row['id']];

               if ($inv <= 0) {$inv = '0';}

               if ($inv <= 0) {

     $data = array('inventory' => $inv, 'prodview'  => 'N');

} else {

     $data = array('inventory' => $inv);

Cheers

Offline

 

#9 07-16-2010 13:49:48

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

The 0300_inventory.php script only runs on completed orders other wise it exits with out running or if the order has been marked as being updated in this section of the code

Code:

// +--
// | Return right away if updates have been done or the order
// | status is not 'P' or 'X'.
// +--

John

Offline

 

#10 07-16-2010 15:33:27

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

dh783 wrote:

The 0300_inventory.php script only runs on completed orders other wise it exits with out running or if the order has been marked as being updated in this section of the code

Code:

// +--
// | Return right away if updates have been done or the order
// | status is not 'P' or 'X'.
// +--

John

Is that not what he wanted John? Maybe I misunderstood sad

Offline

 

#11 07-16-2010 15:44:20

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

He didn't sound quite sure when that file was ran, so I was just stating that it only ran on completed orders.

John

Offline

 

#12 07-27-2010 11:43:32

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Is it possible as soon as an order is made, it is set to complete?

Offline

 

#13 07-27-2010 11:57:02

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

If you wanted to do  this you would have to edit the 0000_status.php script located at Ecom_Order/ECOM_Order.php/ext here

Code:

// +--
// | Figure out if we have any shipped items in our order.  While
// | we do this, mark shipped items as pending shipment and non-shipped
// | items as complete.
// +--

$shipped = 0;

foreach ($order['items'] as $num => $item) {

     if ($item['shipstatus'] != 'N') {

          if ($item['shipstatus'] != 'S') {$order['items'][$num]['shipstatus'] = 'P';}

          $shipped++;

     } // End of if statement.

} // End of if statement.

// +--
// | Now handle updating our order status.
// +--

if (empty($shipped)) {

     $order['order']['status'] = 'C';

} else {

     $order['order']['status'] = 'NS';

} // End of if statement.

John

Offline

 

#14 07-27-2010 12:08:06

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Thanks John,

But what do i change it to?

Thanks again.

Offline

 

#15 07-28-2010 04:21:22

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Okay john, i have changed done this now easier than i thought.

But i am having trouble when the inventory hits "0" how can i get the item to appear as "Not Viewable by Anyone".

If you know it would be a great help, i know i have to edit the 0300_inventory file but i dont know what to change in here.

Thanks

Offline

 

#16 08-04-2010 03:19:33

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Does anyody know how to make the item set to "Not Viewable by Anyone" when sold. i am going holiday in 2 days, so i need this to happen.

Thanks

Offline

 

#17 08-10-2010 00:19:52

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

dansmith490 wrote:

Does anyody know how to make the item set to "Not Viewable by Anyone" when sold. i am going holiday in 2 days, so i need this to happen.

Thanks

Would setting the inventory to declining and not allowing anyone to purchase an item that has zero inventory (a settings toggle) not work? That way they can see the product and it stays on the site for SEO purposes, but you don't oversell.

Offline

 

#18 08-10-2010 08:30:17

lgbsteve
Member
Registered: 04-26-2003
Posts: 182
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Those of us, that sell one of a kind items, would probably like to know how to do this.  When i sell a used book , it's sold.  If I get another of the same title it is not the same book in the same condition.    "This item is currently out of stock",  just clutters up our search pages until we delete the item.


Steve
Collecting Little Golden Books

Offline

 

#19 08-10-2010 18:12:33

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

lgbsteve wrote:

Those of us, that sell one of a kind items, would probably like to know how to do this.  When i sell a used book , it's sold.  If I get another of the same title it is not the same book in the same condition.    "This item is currently out of stock",  just clutters up our search pages until we delete the item.

Do you care if the option is in the cart or not?  For instance, do you require an admin field to control where some products are like this and some aren't, or is the change OK site-wide?

Offline

 

#20 08-10-2010 19:31:01

lgbsteve
Member
Registered: 04-26-2003
Posts: 182
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Thanks for the question.  Site wide would probably be alright for me.  If on the rare chance a customer doesn't send me a payment I can just go back and change the flag to make it viewable again.


Steve
Collecting Little Golden Books

Offline

 

#21 08-10-2010 20:14:38

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Let me take a look into this.  It's beyond the typical forum response level, but since so many people are asking for it I'll give it a shot smile

Offline

 

#22 08-10-2010 21:59:25

lgbsteve
Member
Registered: 04-26-2003
Posts: 182
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Thank you  kryptsupport


Steve
Collecting Little Golden Books

Offline

 

#23 08-10-2010 23:43:40

dh783
Moderator
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

In  your private_dir/apps/ecom/ECOM_Order/ext in the 0300_inventory.php script find this code

Code:

               if ($inv <= 0) {$inv = '0';}

               $data = array('invlevel' => $inv);

               $update_clause = $this->CORE_DB->clause_update(array('table'      => $table,
                                                                    'data'       => $data));

and change like

Code:

 
              if ($inv <= 0) {$inv = '0';}

               $data = array('invlevel' => $inv,
                             'prodview' => 'N');

               $update_clause = $this->CORE_DB->clause_update(array('table'      => $table,
                                                                    'data'       => $data));

this will set any item set for decllining inventory to not viewable by anyone when inventory reaches zero.

John

Last edited by dh783 (08-10-2010 23:48:08)

Offline

 

#24 08-11-2010 08:06:23

KryptoJim
Member
Registered: 07-08-2010
Posts: 455

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Well thanks for that John smile

Offline

 

#25 08-11-2010 19:59:30

lgbsteve
Member
Registered: 04-26-2003
Posts: 182
Website

Re: If an Item Sold, Set to "Not Viewable by Anyone"

Thank you John, it worked GREAT!


Steve
Collecting Little Golden Books

Offline

 

Board footer