Sold Out Statuses
Tytuł
Bez zmianBezpośrednie łącze
Bez zmianzawartość
| Old | New | ||
|---|---|---|---|
| 4 | 4 | ||
| 5 | They can be used to deny purchase of a sold out product or display a custom note i.e. delayed delivery time. | 5 | They can be used to deny purchase of a sold out product or display a custom note i.e. delayed delivery time. |
| 6 | 6 | ||
| 7 | Not 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. | 7 | Not 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 | |||
| 19 | Sold-out statuses doesn't have a reference object. Instead, values from the entity will be returned. | ||
| 20 | |||
| 21 | ```php | ||
| 22 | echo 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 | ``` | ||
Edytowane przez tim w 29 sty 2024 o 23:50