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?
1. EDIT: catalog/model/checkout/order.php
2. FIND:
3. AFTER, ADD:
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
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'] . "'");
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'] . "'");
The code will remove it from its current category(s) and move it to the category id that you choose
Sorry to bring this up again, but with the new version that line has changed to:
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.):
I just dont wanna test it out before i get some conformation on this cause i really do not want to break my store.
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'");
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'");
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.
Who is online
Users browsing this forum: Bing [Bot] and 333 guests