Sold Out Statuses

Názov

No changes

Permalink

No changes

Obsah

OldNew
4 4
5They can be used to deny purchase of a sold out product or display a custom note i.e. delayed delivery time. 5They can be used to deny purchase of a sold out product or display a custom note i.e. delayed delivery time.
6 6
7Not to be confused with [Delivery Statuses](delivery_statuses) where a sold out status is display instead of a delivery status when a product is sold out.7Not to be confused with [Delivery Statuses](delivery_statuses) where a sold out status is display instead of a delivery status when a product is sold out.
8
9## Entity Object
10
11```php
12$sold_out_status = new ent_sold_out_status();
13$sold_out_status->data['name']['en'] = 'Sold Out;
14$sold_out_status->save();
15```
16
17## Reference Model
18
19Sold-out statuses doesn't have a reference object. Instead, values from the entity will be returned.
20
21```php
22echo reference::soldout_status($status_id)->name[$language_code];
23```
24
25## Database Query
26
27```php
28$query = database::query(
29 "select ss.id, ssi.name from ". DB_TABLE_PREFIX ."sold_out_statuses ss
30 left join ". DB_TABLE_PREFIX ."sold_out_statuses_info ssi on (ssi.sold_out_status_id = ss.id and ssi.language_code = 'en')
31 where ss.id = ". (int)$sold_out_status_id ."
32 limit 1;"
33);
34
35$sold_out_status = database::fetch($query);
36```

Edited by tim on 29 jan 2024 at 23:50

View code on GitHub