PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / Model / CsvPackageProduct.php

CsvPackageProduct.php in MBE eShip trunk, at lib/Model/CsvPackageProduct.php

51 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Mbe_Shipping_Model_Csv_Package_Product implements Mbe_Shipping_Entity_Model_Interface
4 {
5 use \Traits\Mbe_Entity_Model_Trait {
6 insertRow as protected traitInserRow;
7 truncate as protected traitTruncate;
8 tableExists as protected traitTableExists;
9 insertRow as protected traitInsertRow;
10 updateRow as protected traitUpdateRow;
11 }
12
13 public function tableExists() {
14 return $this->traitTableExists($this->getTableName());
15 }
16
17 public function truncate() {
18 return $this->traitTruncate($this->getTableName());
19 }
20
21 public function insertRow($row ) {
22 return $this->traitInserRow($this->getTableName(), $row);
23 }
24
25 public function updateRow($id, $row ) {
26 return $this->traitUpdateRow($this->getTableName(), $id, $row);
27 }
28
29 public function getTableName() {
30 global $wpdb;
31 return $wpdb->prefix . Mbe_Shipping_Helper_Data::MBE_CSV_PACKAGES_PRODUCT_TABLE_NAME;
32 }
33
34 public function getSqlCreate() {
35 global $wpdb;
36 $charset = $wpdb->get_charset_collate();
37
38 return "CREATE TABLE " . $this->getTableName() . " (
39 custom_package tinyint(1) null ,
40 single_parcel tinyint(1) null ,
41 product_sku varchar(64) not null ,
42 package_code varchar(50) not null ,
43 id int(10) unsigned auto_increment ,
44 primary key (id),
45 unique key MBE_PKG_PROD_PACKAGE_PRODUCT_UNIQUE (package_code, product_sku),
46 unique key MBE_PKG_PROD_PRODUCT_SKU (product_sku),
47 key MBE_PKG_PROD_PACKAGE_CODE (package_code)
48 ) $charset;";
49 }
50
51 }