Post by curtisblackwell » Mon Jan 18, 2010 11:44 pm

I'm working on a website for an artist. All of his items are unique and he wants the items to be listed in an archive after they're sold. Is there a way to have an item's category change right after it's sold?


Posts

Joined
Mon Jan 18, 2010 11:39 pm

Post by Qphoria » Tue Jan 19, 2010 3:52 am

1. EDIT: catalog/model/checkout/order.php

2. FIND:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "'");
3. AFTER, ADD:

Code: Select all

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product['product_id'] . "'");
$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET category_id = '999', product_id = '" . (int)$product['product_id'] . "'");
Change 999 to the category id of the archive category.
The code will remove it from its current category(s) and move it to the category id that you choose

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Redostrike » Tue May 24, 2011 5:09 am

Sorry to bring this up again, but with the new version that line has changed to:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "' AND subtract = '1'");
As i have a very low understandment of php i might already figured this out myself with this code (Second line needs the substract now.):

Code: Select all

    $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product['product_id'] . "'");
    $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET category_id = '999', product_id = '" . (int)$product['product_id'] . "'" AND subtract = '1'");
I just dont wanna test it out before i get some conformation on this cause i really do not want to break my store.

Newbie

Posts

Joined
Tue Apr 05, 2011 3:11 am

Post by rikmg67 » Thu Sep 28, 2017 7:27 pm

bump! anyone?

Newbie

Posts

Joined
Thu Nov 29, 2012 12:44 am

Post by MrPhil » Fri Sep 29, 2017 3:17 am

It should be possible to move a one-of-a-kind product to another "not for sale" category, but I'm not sure that's the ideal solution to mix in a gallery of sold (and unavailable) products with active sales of other products. You would have to have different code to not display sales information, and even then it would be confusing to browsers (still being mixed together). Have you considered removing these sold products from the store and putting them in a separate gallery application? It should even be possible to automate the whole thing (with some custom coding) to copy the item into the gallery's database (including a "sold for" price in the description) and then delete the product from the store. At the top level, the site would have a landing page with a link to the store and a link to the gallery.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm
Who is online

Users browsing this forum: Bing [Bot] and 333 guests