PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 114
Lasso Lite – Affiliate Link Manager & Product Displays v114
158 157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 All 57 releases
simple-urls / models / class-amazon-products.php

class-amazon-products.php in Lasso Lite – Affiliate Link Manager & Product Displays 114, at models/class-amazon-products.php

85 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Models
4 *
5 * @package Models
6 */
7
8 namespace LassoLite\Models;
9
10 /**
11 * Model
12 */
13 class Amazon_Products extends Model {
14 /**
15 * Table name
16 *
17 * @var string
18 */
19 protected $table = 'lasso_lite_amazon_products';
20
21 /**
22 * Columns of the table
23 *
24 * @var array
25 */
26 protected $columns = array(
27 'amazon_id',
28 'default_product_name',
29 'latest_price',
30 'base_url',
31 'monetized_url',
32
33 'default_image',
34 'out_of_stock',
35 'is_prime',
36 'currency',
37 'savings_amount',
38
39 'savings_percent',
40 'savings_basis',
41 'features',
42 'is_manual',
43 'last_updated',
44 );
45
46 /**
47 * Primary key of the table
48 *
49 * @var string
50 */
51 protected $primary_key = 'amazon_id';
52
53 /**
54 * Create table
55 */
56 public function create_table() {
57 $columns_sql = '
58 amazon_id varchar(20) NOT NULL,
59 default_product_name varchar(2000) NOT NULL,
60 latest_price varchar(32) NULL,
61 base_url varchar(2000) NOT NULL,
62 monetized_url varchar(2000) NULL,
63 default_image varchar(10000) NULL,
64 out_of_stock TINYINT(1) NULL DEFAULT 0,
65 is_prime TINYINT(1) NOT NULL DEFAULT 0,
66 currency VARCHAR(5) NOT NULL DEFAULT \'USD\',
67 savings_amount VARCHAR(10) NULL,
68 savings_percent INT(10) NULL,
69 savings_basis VARCHAR(10) NULL,
70 features TEXT NULL,
71 is_manual TINYINT(1) NOT NULL DEFAULT 0,
72 rating VARCHAR(10) NULL DEFAULT 0,
73 reviews INT(11) NULL DEFAULT 0,
74 last_updated datetime NOT NULL,
75 PRIMARY KEY (amazon_id)
76 ';
77 $sql = '
78 CREATE TABLE ' . $this->get_table_name() . ' (
79 ' . $columns_sql . '
80 ) ' . $this->get_charset_collate();
81
82 return $this->modify_table( $sql, $this->get_table_name() );
83 }
84 }
85