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.
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
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
HI Graham,
Yeah the products are one off custom products, do you know where i would have to do this?
Thanks
Offline
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
HI John,
Do you know where abouts and what to edit.
Thanks mate
Offline
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
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?
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
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
// +-- // | Return right away if updates have been done or the order // | status is not 'P' or 'X'. // +--
John
Offline
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
Offline
Is it possible as soon as an order is made, it is set to complete?
Offline
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
// +-- // | 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
Thanks John,
But what do i change it to?
Thanks again.
Offline
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
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
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
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.
Offline
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
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.
Offline
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
Offline
In your private_dir/apps/ecom/ECOM_Order/ext in the 0300_inventory.php script find this 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
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
Well thanks for that John
Offline