@@ -10,19 +10,19 @@ |
||
| 10 | 10 | |
| 11 | 11 | static $menu_title = 'Orders'; |
| 12 | 12 | |
| 13 | - public function getEditForm($id = null, $fields = null) { |
|
| 14 | - $form = parent::getEditForm($id, $fields); |
|
| 13 | + public function getEditForm($id = null, $fields = null) { |
|
| 14 | + $form = parent::getEditForm($id, $fields); |
|
| 15 | 15 | |
| 16 | - $gridFieldName = $this->sanitiseClassName($this->modelClass); |
|
| 17 | - $gridField = $form->Fields()->fieldByName($gridFieldName); |
|
| 16 | + $gridFieldName = $this->sanitiseClassName($this->modelClass); |
|
| 17 | + $gridField = $form->Fields()->fieldByName($gridFieldName); |
|
| 18 | 18 | |
| 19 | - // GridField configuration |
|
| 20 | - $config = $gridField->getConfig(); |
|
| 19 | + // GridField configuration |
|
| 20 | + $config = $gridField->getConfig(); |
|
| 21 | 21 | |
| 22 | - // remove edit icon |
|
| 23 | - $config->removeComponentsByType('GridFieldEditButton'); |
|
| 22 | + // remove edit icon |
|
| 23 | + $config->removeComponentsByType('GridFieldEditButton'); |
|
| 24 | 24 | |
| 25 | - return $form; |
|
| 26 | - } |
|
| 25 | + return $form; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | } |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | $input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2]).'\1%', '${1}'.$prefix.self::fc_hash_value($code, $name[2], $value[2], 'name', FALSE)."$1", $input); |
| 253 | 253 | } |
| 254 | 254 | self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
| 255 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]). |
|
| 256 | - '</strong> :: Value: <strong>'.htmlspecialchars($value[2]). |
|
| 257 | - '</strong><br />Initial input: '.htmlspecialchars($input). |
|
| 258 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>'; |
|
| 255 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]). |
|
| 256 | + '</strong> :: Value: <strong>'.htmlspecialchars($value[2]). |
|
| 257 | + '</strong><br />Initial input: '.htmlspecialchars($input). |
|
| 258 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>'; |
|
| 259 | 259 | $form = str_replace($input, $input_signed, $form); |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | $option[0]); |
| 277 | 277 | $form_part_signed = str_replace($option[0], $option_signed, $form_part_signed ); |
| 278 | 278 | self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
| 279 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]). |
|
| 280 | - '</strong> :: Value: <strong>'.htmlspecialchars($option[2]). |
|
| 281 | - '</strong><br />Initial option: '.htmlspecialchars($option[0]). |
|
| 282 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>'; |
|
| 279 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]). |
|
| 280 | + '</strong> :: Value: <strong>'.htmlspecialchars($option[2]). |
|
| 281 | + '</strong><br />Initial option: '.htmlspecialchars($option[0]). |
|
| 282 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>'; |
|
| 283 | 283 | } |
| 284 | 284 | $form = str_replace($list[0], $form_part_signed, $form); |
| 285 | 285 | } |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | $textarea_signed = preg_replace('%([\'"])'.preg_quote($prefix.$textarea[2]).'\1%', "$1".self::fc_hash_value($code, $textarea[2], $textarea[3], 'name', FALSE)."$1", $textarea[0]); |
| 296 | 296 | $form = str_replace($textarea[0], $textarea_signed, $form); |
| 297 | 297 | self::$log[] = '<strong>TEXTAREA:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). |
| 298 | - '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]). |
|
| 299 | - '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]). |
|
| 300 | - '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]). |
|
| 301 | - '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>'; |
|
| 298 | + '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]). |
|
| 299 | + '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]). |
|
| 300 | + '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]). |
|
| 301 | + '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>'; |
|
| 302 | 302 | } |
| 303 | 303 | self::$log[] = '<strong>FORM after TEXTAREAS:</strong> <pre>'.htmlspecialchars($form).'</pre>'; |
| 304 | 304 | |
@@ -48,69 +48,69 @@ |
||
| 48 | 48 | return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName() ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * FoxyCart API v1.1 functions |
|
| 53 | - */ |
|
| 54 | - |
|
| 55 | - // FoxyCart API Request |
|
| 56 | - private static function getAPIRequest($foxyData = array()) { |
|
| 57 | - |
|
| 58 | - $foxy_domain = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
| 59 | - $foxyData["api_token"] = FoxyCart::getStoreKey(); |
|
| 60 | - |
|
| 61 | - $ch = curl_init(); |
|
| 62 | - curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api"); |
|
| 63 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData); |
|
| 64 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 65 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
|
| 66 | - curl_setopt($ch, CURLOPT_TIMEOUT, 15); |
|
| 67 | - // If you get SSL errors, you can uncomment the following, or ask your host to add the appropriate CA bundle |
|
| 68 | - // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
| 69 | - $response = trim(curl_exec($ch)); |
|
| 70 | - |
|
| 71 | - // The following if block will print any CURL errors you might have |
|
| 72 | - if ($response == false) { |
|
| 73 | - //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR); |
|
| 74 | - SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR); |
|
| 75 | - } |
|
| 76 | - curl_close($ch); |
|
| 77 | - |
|
| 78 | - return $response; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - public static function getCustomer($Member = null) { |
|
| 82 | - |
|
| 83 | - // throw error if no $Member Object |
|
| 84 | - if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR); |
|
| 85 | - |
|
| 86 | - // grab customer record from API |
|
| 87 | - |
|
| 88 | - $foxyData = array(); |
|
| 89 | - $foxyData["api_action"] = "customer_get"; |
|
| 90 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 91 | - $foxyData["customer_email"] = $Member->Email; |
|
| 92 | - |
|
| 93 | - return self::getAPIRequest($foxyData); |
|
| 94 | - |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - public static function putCustomer($Member = null) { |
|
| 98 | - // throw error if no $Member Object |
|
| 99 | - if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR); |
|
| 100 | - |
|
| 101 | - // send updated customer record from API |
|
| 102 | - $foxyData = array(); |
|
| 103 | - $foxyData["api_action"] = "customer_save"; |
|
| 104 | - // customer_id will be 0 if created in SilverStripe. |
|
| 105 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 106 | - $foxyData["customer_email"] = $Member->Email; |
|
| 107 | - $foxyData["customer_password_hash"] = $Member->Password; |
|
| 108 | - $foxyData["customer_password_salt"] = $Member->Salt; |
|
| 109 | - $foxyData["customer_first_name"] = $Member->FirstName; |
|
| 110 | - $foxyData["customer_last_name"] = $Member->Surname; |
|
| 111 | - |
|
| 112 | - return self::getAPIRequest($foxyData); |
|
| 113 | - } |
|
| 51 | + /** |
|
| 52 | + * FoxyCart API v1.1 functions |
|
| 53 | + */ |
|
| 54 | + |
|
| 55 | + // FoxyCart API Request |
|
| 56 | + private static function getAPIRequest($foxyData = array()) { |
|
| 57 | + |
|
| 58 | + $foxy_domain = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
| 59 | + $foxyData["api_token"] = FoxyCart::getStoreKey(); |
|
| 60 | + |
|
| 61 | + $ch = curl_init(); |
|
| 62 | + curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api"); |
|
| 63 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData); |
|
| 64 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 65 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
|
| 66 | + curl_setopt($ch, CURLOPT_TIMEOUT, 15); |
|
| 67 | + // If you get SSL errors, you can uncomment the following, or ask your host to add the appropriate CA bundle |
|
| 68 | + // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
| 69 | + $response = trim(curl_exec($ch)); |
|
| 70 | + |
|
| 71 | + // The following if block will print any CURL errors you might have |
|
| 72 | + if ($response == false) { |
|
| 73 | + //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR); |
|
| 74 | + SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR); |
|
| 75 | + } |
|
| 76 | + curl_close($ch); |
|
| 77 | + |
|
| 78 | + return $response; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + public static function getCustomer($Member = null) { |
|
| 82 | + |
|
| 83 | + // throw error if no $Member Object |
|
| 84 | + if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR); |
|
| 85 | + |
|
| 86 | + // grab customer record from API |
|
| 87 | + |
|
| 88 | + $foxyData = array(); |
|
| 89 | + $foxyData["api_action"] = "customer_get"; |
|
| 90 | + if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 91 | + $foxyData["customer_email"] = $Member->Email; |
|
| 92 | + |
|
| 93 | + return self::getAPIRequest($foxyData); |
|
| 94 | + |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + public static function putCustomer($Member = null) { |
|
| 98 | + // throw error if no $Member Object |
|
| 99 | + if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR); |
|
| 100 | + |
|
| 101 | + // send updated customer record from API |
|
| 102 | + $foxyData = array(); |
|
| 103 | + $foxyData["api_action"] = "customer_save"; |
|
| 104 | + // customer_id will be 0 if created in SilverStripe. |
|
| 105 | + if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 106 | + $foxyData["customer_email"] = $Member->Email; |
|
| 107 | + $foxyData["customer_password_hash"] = $Member->Password; |
|
| 108 | + $foxyData["customer_password_salt"] = $Member->Salt; |
|
| 109 | + $foxyData["customer_first_name"] = $Member->FirstName; |
|
| 110 | + $foxyData["customer_last_name"] = $Member->Surname; |
|
| 111 | + |
|
| 112 | + return self::getAPIRequest($foxyData); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | public static function getKeyPrefix(){ |
| 116 | 116 | return self::$keyPrefix; |
@@ -7,31 +7,31 @@ discard block |
||
| 7 | 7 | private static $description = ''; |
| 8 | 8 | |
| 9 | 9 | private static $db = array( |
| 10 | - 'Quantity' => 'Int', |
|
| 11 | - 'Price' => 'Currency' |
|
| 12 | - ); |
|
| 10 | + 'Quantity' => 'Int', |
|
| 11 | + 'Price' => 'Currency' |
|
| 12 | + ); |
|
| 13 | 13 | |
| 14 | 14 | private static $has_one = array( |
| 15 | - 'Product' => 'ProductPage', |
|
| 16 | - 'Order' => 'Order' |
|
| 17 | - ); |
|
| 15 | + 'Product' => 'ProductPage', |
|
| 16 | + 'Order' => 'Order' |
|
| 17 | + ); |
|
| 18 | 18 | |
| 19 | 19 | private static $many_many = array( |
| 20 | - 'Options' => 'OptionItem' |
|
| 21 | - ); |
|
| 20 | + 'Options' => 'OptionItem' |
|
| 21 | + ); |
|
| 22 | 22 | |
| 23 | 23 | private static $summary_fields = array( |
| 24 | - 'Product.Title', |
|
| 25 | - 'Quantity', |
|
| 26 | - 'Price.Nice' |
|
| 27 | - ); |
|
| 24 | + 'Product.Title', |
|
| 25 | + 'Quantity', |
|
| 26 | + 'Price.Nice' |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | 29 | public function getCMSFields(){ |
| 30 | 30 | $fields = parent::getCMSFields(); |
| 31 | 31 | |
| 32 | - $fields->addFieldsToTab('Root.Options', array( |
|
| 33 | - GridField::create('Options', 'Product Options', $this->Options(), GridFieldConfig_RecordViewer::create()) |
|
| 34 | - )); |
|
| 32 | + $fields->addFieldsToTab('Root.Options', array( |
|
| 33 | + GridField::create('Options', 'Product Options', $this->Options(), GridFieldConfig_RecordViewer::create()) |
|
| 34 | + )); |
|
| 35 | 35 | |
| 36 | 36 | $this->extend('updateCMSFields', $fields); |
| 37 | 37 | return $fields; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function canEdit($member = null) { |
| 55 | - return false; |
|
| 55 | + return false; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function canDelete($member = null) { |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function getCMSFields(){ |
| 28 | 28 | $fields = FieldList::create( |
| 29 | - TextField::create('Title') |
|
| 30 | - ->setTitle(_t('ProductImage.Title', 'Product Image Title')), |
|
| 31 | - UploadField::create('Image') |
|
| 32 | - ->setTitle(_t('ProductCategory.Image', 'Product Image')) |
|
| 33 | - ->setFolderName('Uploads/Products') |
|
| 34 | - ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')) |
|
| 35 | - ); |
|
| 29 | + TextField::create('Title') |
|
| 30 | + ->setTitle(_t('ProductImage.Title', 'Product Image Title')), |
|
| 31 | + UploadField::create('Image') |
|
| 32 | + ->setTitle(_t('ProductCategory.Image', 'Product Image')) |
|
| 33 | + ->setFolderName('Uploads/Products') |
|
| 34 | + ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')) |
|
| 35 | + ); |
|
| 36 | 36 | |
| 37 | 37 | $this->extend('updateCMSFields', $fields); |
| 38 | 38 | |
| 39 | - return $fields; |
|
| 39 | + return $fields; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function canView($member = false) { |
@@ -3,112 +3,112 @@ |
||
| 3 | 3 | class Order extends DataObject implements PermissionProvider{ |
| 4 | 4 | |
| 5 | 5 | private static $db = array( |
| 6 | - 'Order_ID' => 'Int', |
|
| 7 | - 'Store_ID' => 'Int', |
|
| 8 | - 'StoreVersion' => 'Varchar', |
|
| 9 | - 'IsTest' => 'Boolean', |
|
| 10 | - 'IsHidden' => 'Boolean', |
|
| 11 | - 'DataIsFed' => 'Boolean', |
|
| 12 | - 'TransactionDate' => 'SS_Datetime', |
|
| 13 | - 'ProcessorResponse' => 'Varchar(200)', |
|
| 14 | - 'ShiptoShippingServiceDescription' => 'Varchar(200)', |
|
| 15 | - 'ProductTotal' => 'Currency', |
|
| 16 | - 'TaxTotal' => 'Currency', |
|
| 17 | - 'ShippingTotal' => 'Currency', |
|
| 18 | - 'OrderTotal' => 'Currency', |
|
| 19 | - 'PaymentGatewayType' => 'Varchar(100)', |
|
| 20 | - 'ReceiptURL' => 'Varchar(255)', |
|
| 21 | - 'OrderStatus' => 'Varchar(255)', |
|
| 22 | - 'CustomerIP' => 'Varchar', |
|
| 23 | - 'Response' => 'Text' |
|
| 24 | - ); |
|
| 6 | + 'Order_ID' => 'Int', |
|
| 7 | + 'Store_ID' => 'Int', |
|
| 8 | + 'StoreVersion' => 'Varchar', |
|
| 9 | + 'IsTest' => 'Boolean', |
|
| 10 | + 'IsHidden' => 'Boolean', |
|
| 11 | + 'DataIsFed' => 'Boolean', |
|
| 12 | + 'TransactionDate' => 'SS_Datetime', |
|
| 13 | + 'ProcessorResponse' => 'Varchar(200)', |
|
| 14 | + 'ShiptoShippingServiceDescription' => 'Varchar(200)', |
|
| 15 | + 'ProductTotal' => 'Currency', |
|
| 16 | + 'TaxTotal' => 'Currency', |
|
| 17 | + 'ShippingTotal' => 'Currency', |
|
| 18 | + 'OrderTotal' => 'Currency', |
|
| 19 | + 'PaymentGatewayType' => 'Varchar(100)', |
|
| 20 | + 'ReceiptURL' => 'Varchar(255)', |
|
| 21 | + 'OrderStatus' => 'Varchar(255)', |
|
| 22 | + 'CustomerIP' => 'Varchar', |
|
| 23 | + 'Response' => 'Text' |
|
| 24 | + ); |
|
| 25 | 25 | |
| 26 | 26 | private static $has_one = array( |
| 27 | - 'Member' => 'Member', |
|
| 28 | - 'BillingAddress' => 'OrderAddress', |
|
| 29 | - 'ShippingAddress' => 'OrderAddress' |
|
| 30 | - ); |
|
| 27 | + 'Member' => 'Member', |
|
| 28 | + 'BillingAddress' => 'OrderAddress', |
|
| 29 | + 'ShippingAddress' => 'OrderAddress' |
|
| 30 | + ); |
|
| 31 | 31 | |
| 32 | 32 | private static $has_many = array( |
| 33 | - 'Details' => 'OrderDetail' |
|
| 34 | - ); |
|
| 35 | - |
|
| 36 | - private static $singular_name = 'Order'; |
|
| 37 | - private static $plural_name = 'Orders'; |
|
| 38 | - private static $description = 'Orders from FoxyCart Datafeed'; |
|
| 39 | - private static $default_sort = 'TransactionDate DESC'; |
|
| 40 | - |
|
| 41 | - private static $summary_fields = array( |
|
| 42 | - 'Order_ID', |
|
| 43 | - 'TransactionDate.NiceUS', |
|
| 44 | - 'Member.Name', |
|
| 45 | - 'ProductTotal.Nice', |
|
| 46 | - 'TaxTotal.Nice', |
|
| 47 | - 'ShippingTotal.Nice', |
|
| 48 | - 'OrderTotal.Nice', |
|
| 49 | - 'ReceiptLink' |
|
| 50 | - ); |
|
| 33 | + 'Details' => 'OrderDetail' |
|
| 34 | + ); |
|
| 35 | + |
|
| 36 | + private static $singular_name = 'Order'; |
|
| 37 | + private static $plural_name = 'Orders'; |
|
| 38 | + private static $description = 'Orders from FoxyCart Datafeed'; |
|
| 39 | + private static $default_sort = 'TransactionDate DESC'; |
|
| 40 | + |
|
| 41 | + private static $summary_fields = array( |
|
| 42 | + 'Order_ID', |
|
| 43 | + 'TransactionDate.NiceUS', |
|
| 44 | + 'Member.Name', |
|
| 45 | + 'ProductTotal.Nice', |
|
| 46 | + 'TaxTotal.Nice', |
|
| 47 | + 'ShippingTotal.Nice', |
|
| 48 | + 'OrderTotal.Nice', |
|
| 49 | + 'ReceiptLink' |
|
| 50 | + ); |
|
| 51 | 51 | |
| 52 | 52 | private static $searchable_fields = array( |
| 53 | - 'Order_ID', |
|
| 54 | - 'TransactionDate' => array( |
|
| 55 | - "field" => "DateField", |
|
| 56 | - "filter" => "PartialMatchFilter" |
|
| 57 | - ), |
|
| 58 | - 'Member.ID', |
|
| 59 | - 'OrderTotal', |
|
| 60 | - 'Details.ProductID' |
|
| 61 | - ); |
|
| 62 | - |
|
| 63 | - private static $casting = array( |
|
| 64 | - 'ReceiptLink' => 'HTMLVarchar' |
|
| 65 | - ); |
|
| 53 | + 'Order_ID', |
|
| 54 | + 'TransactionDate' => array( |
|
| 55 | + "field" => "DateField", |
|
| 56 | + "filter" => "PartialMatchFilter" |
|
| 57 | + ), |
|
| 58 | + 'Member.ID', |
|
| 59 | + 'OrderTotal', |
|
| 60 | + 'Details.ProductID' |
|
| 61 | + ); |
|
| 62 | + |
|
| 63 | + private static $casting = array( |
|
| 64 | + 'ReceiptLink' => 'HTMLVarchar' |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | - private static $indexes = array( |
|
| 68 | - 'Order_ID' => true // make unique |
|
| 69 | - ); |
|
| 70 | - |
|
| 71 | - function fieldLabels($includerelations = true) { |
|
| 72 | - $labels = parent::fieldLabels(); |
|
| 73 | - |
|
| 74 | - $labels['Order_ID'] = _t('Order.Order_ID', 'Order ID#'); |
|
| 75 | - $labels['TransactionDate'] = _t('Order.TransactionDate', "Date"); |
|
| 76 | - $labels['TransactionDate.NiceUS'] = _t('Order.TransactionDate', "Date"); |
|
| 77 | - $labels['Member.Name'] = _t('Order.MemberName', 'Customer'); |
|
| 78 | - $labels['Member.ID'] = _t('Order.MemberName', 'Customer'); |
|
| 79 | - $labels['ProductTotal.Nice'] = _t('Order.ProductTotal', 'Sub Total'); |
|
| 80 | - $labels['TaxTotal.Nice'] = _t('Order.TaxTotal', 'Tax'); |
|
| 81 | - $labels['ShippingTotal.Nice'] = _t('Order.ShippingTotal', 'Shipping'); |
|
| 82 | - $labels['OrderTotal'] = _t('Order.OrderTotal', 'Total'); |
|
| 83 | - $labels['OrderTotal.Nice'] = _t('Order.OrderTotal', 'Total'); |
|
| 84 | - $labels['ReceiptLink'] = _t('Order.ReceiptLink', 'Invoice'); |
|
| 85 | - $labels['Details.ProductID'] = _t('Order.Details.ProductID', 'Product'); |
|
| 86 | - |
|
| 87 | - return $labels; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - function ReceiptLink() { |
|
| 91 | - return $this->getReceiptLink(); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - function getReceiptLink(){ |
|
| 95 | - $obj= HTMLVarchar::create(); |
|
| 96 | - $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>'); |
|
| 97 | - return $obj; |
|
| 98 | - } |
|
| 67 | + private static $indexes = array( |
|
| 68 | + 'Order_ID' => true // make unique |
|
| 69 | + ); |
|
| 70 | + |
|
| 71 | + function fieldLabels($includerelations = true) { |
|
| 72 | + $labels = parent::fieldLabels(); |
|
| 73 | + |
|
| 74 | + $labels['Order_ID'] = _t('Order.Order_ID', 'Order ID#'); |
|
| 75 | + $labels['TransactionDate'] = _t('Order.TransactionDate', "Date"); |
|
| 76 | + $labels['TransactionDate.NiceUS'] = _t('Order.TransactionDate', "Date"); |
|
| 77 | + $labels['Member.Name'] = _t('Order.MemberName', 'Customer'); |
|
| 78 | + $labels['Member.ID'] = _t('Order.MemberName', 'Customer'); |
|
| 79 | + $labels['ProductTotal.Nice'] = _t('Order.ProductTotal', 'Sub Total'); |
|
| 80 | + $labels['TaxTotal.Nice'] = _t('Order.TaxTotal', 'Tax'); |
|
| 81 | + $labels['ShippingTotal.Nice'] = _t('Order.ShippingTotal', 'Shipping'); |
|
| 82 | + $labels['OrderTotal'] = _t('Order.OrderTotal', 'Total'); |
|
| 83 | + $labels['OrderTotal.Nice'] = _t('Order.OrderTotal', 'Total'); |
|
| 84 | + $labels['ReceiptLink'] = _t('Order.ReceiptLink', 'Invoice'); |
|
| 85 | + $labels['Details.ProductID'] = _t('Order.Details.ProductID', 'Product'); |
|
| 86 | + |
|
| 87 | + return $labels; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + function ReceiptLink() { |
|
| 91 | + return $this->getReceiptLink(); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + function getReceiptLink(){ |
|
| 95 | + $obj= HTMLVarchar::create(); |
|
| 96 | + $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>'); |
|
| 97 | + return $obj; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | public function canView($member = false) { |
| 101 | 101 | return Permission::check('Product_ORDERS'); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function canEdit($member = null) { |
| 105 | - //return Permission::check('Product_ORDERS'); |
|
| 106 | - return false; |
|
| 105 | + //return Permission::check('Product_ORDERS'); |
|
| 106 | + return false; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function canDelete($member = null) { |
| 110 | - return false; |
|
| 111 | - //return Permission::check('Product_ORDERS'); |
|
| 110 | + return false; |
|
| 111 | + //return Permission::check('Product_ORDERS'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function canCreate($member = null) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | 'Title' => 'Varchar(100)' |
| 12 | 12 | ); |
| 13 | 13 | |
| 14 | - private static $singular_name = 'Product Option Group'; |
|
| 14 | + private static $singular_name = 'Product Option Group'; |
|
| 15 | 15 | private static $plural_name = 'Product Option Groups'; |
| 16 | 16 | private static $description = 'Groups of product options, e.g. size, color, etc'; |
| 17 | 17 | |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | $do->write(); |
| 34 | 34 | } |
| 35 | 35 | if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) { |
| 36 | - $do = new OptionGroup(); |
|
| 37 | - $do->Title = "Size"; |
|
| 38 | - $do->write(); |
|
| 39 | - } |
|
| 40 | - if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) { |
|
| 41 | - $do = new OptionGroup(); |
|
| 42 | - $do->Title = "Color"; |
|
| 43 | - $do->write(); |
|
| 44 | - } |
|
| 45 | - if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) { |
|
| 46 | - $do = new OptionGroup(); |
|
| 47 | - $do->Title = "Type"; |
|
| 48 | - $do->write(); |
|
| 49 | - } |
|
| 36 | + $do = new OptionGroup(); |
|
| 37 | + $do->Title = "Size"; |
|
| 38 | + $do->write(); |
|
| 39 | + } |
|
| 40 | + if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) { |
|
| 41 | + $do = new OptionGroup(); |
|
| 42 | + $do->Title = "Color"; |
|
| 43 | + $do->write(); |
|
| 44 | + } |
|
| 45 | + if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) { |
|
| 46 | + $do = new OptionGroup(); |
|
| 47 | + $do->Title = "Type"; |
|
| 48 | + $do->write(); |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getCMSValidator() { |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | //'Category' => 'ProductCategory' |
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | - private static $belongs_many_many = array( |
|
| 29 | - 'OrderDetails' => 'OrderDetail' |
|
| 30 | - ); |
|
| 28 | + private static $belongs_many_many = array( |
|
| 29 | + 'OrderDetails' => 'OrderDetail' |
|
| 30 | + ); |
|
| 31 | 31 | |
| 32 | - private static $defaults = array( |
|
| 32 | + private static $defaults = array( |
|
| 33 | 33 | 'Available' => true |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | private static $summary_fields = array( |
| 37 | 37 | 'Title' => 'Title', |
| 38 | 38 | 'ProductOptionGroup.Title' => 'Group', |
| 39 | - 'Available.Nice' => 'Available' |
|
| 39 | + 'Available.Nice' => 'Available' |
|
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | private static $default_sort = 'SortOrder'; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | // set variables from Product |
| 53 | - $productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage'); |
|
| 54 | - $product = ProductPage::get()->byID($productID); |
|
| 53 | + $productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage'); |
|
| 54 | + $product = ProductPage::get()->byID($productID); |
|
| 55 | 55 | |
| 56 | 56 | $parentPrice = $product->obj('Price')->Nice(); |
| 57 | 57 | $parentWeight = $product->Weight; |
@@ -59,21 +59,21 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // ProductOptionGroup Dropdown field w/ add new |
| 61 | 61 | $groups = function(){ |
| 62 | - return OptionGroup::get()->map()->toArray(); |
|
| 62 | + return OptionGroup::get()->map()->toArray(); |
|
| 63 | 63 | }; |
| 64 | 64 | $groupFields = singleton('OptionGroup')->getCMSFields(); |
| 65 | 65 | $groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups()) |
| 66 | 66 | ->setEmptyString('') |
| 67 | - ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>')); |
|
| 67 | + ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>')); |
|
| 68 | 68 | if (class_exists('QuickAddNewExtension')) $groupField->useAddNew('OptionGroup', $groups, $groupFields); |
| 69 | 69 | |
| 70 | - $fields->addFieldsToTab('Root.Main', array( |
|
| 70 | + $fields->addFieldsToTab('Root.Main', array( |
|
| 71 | 71 | HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2), |
| 72 | 72 | Textfield::create('Title') |
| 73 | - ->setTitle(_t("OptionItem.Title", "Product Option Name")), |
|
| 73 | + ->setTitle(_t("OptionItem.Title", "Product Option Name")), |
|
| 74 | 74 | CheckboxField::create('Available') |
| 75 | 75 | ->setTitle( _t("OptionItem.Available", "Available for purchase")) |
| 76 | - ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")), |
|
| 76 | + ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")), |
|
| 77 | 77 | $groupField |
| 78 | 78 | )); |
| 79 | 79 | |
@@ -83,22 +83,22 @@ discard block |
||
| 83 | 83 | // Weight Modifier Fields |
| 84 | 84 | HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3), |
| 85 | 85 | NumericField::create('WeightModifier') |
| 86 | - ->setTitle(_t('OptionItem.WeightModifier', 'Weight')), |
|
| 86 | + ->setTitle(_t('OptionItem.WeightModifier', 'Weight')), |
|
| 87 | 87 | DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'), |
| 88 | 88 | array( |
| 89 | - 'Add' => _t( |
|
| 90 | - 'OptionItem.WeightAdd', |
|
| 91 | - "Add to Base Weight ({weight})", |
|
| 92 | - 'Add to weight', |
|
| 93 | - array('weight' => $parentWeight) |
|
| 94 | - ), |
|
| 95 | - 'Subtract' => _t( |
|
| 96 | - 'OptionItem.WeightSubtract', |
|
| 97 | - "Subtract from Base Weight ({weight})", |
|
| 98 | - 'Subtract from weight', |
|
| 99 | - array('weight' => $parentWeight) |
|
| 100 | - ), |
|
| 101 | - 'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight') |
|
| 89 | + 'Add' => _t( |
|
| 90 | + 'OptionItem.WeightAdd', |
|
| 91 | + "Add to Base Weight ({weight})", |
|
| 92 | + 'Add to weight', |
|
| 93 | + array('weight' => $parentWeight) |
|
| 94 | + ), |
|
| 95 | + 'Subtract' => _t( |
|
| 96 | + 'OptionItem.WeightSubtract', |
|
| 97 | + "Subtract from Base Weight ({weight})", |
|
| 98 | + 'Subtract from weight', |
|
| 99 | + array('weight' => $parentWeight) |
|
| 100 | + ), |
|
| 101 | + 'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight') |
|
| 102 | 102 | ) |
| 103 | 103 | )->setEmptyString('') |
| 104 | 104 | ->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')), |
@@ -106,21 +106,21 @@ discard block |
||
| 106 | 106 | // Price Modifier FIelds |
| 107 | 107 | HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3), |
| 108 | 108 | CurrencyField::create('PriceModifier') |
| 109 | - ->setTitle(_t('OptionItem.PriceModifier', 'Price')), |
|
| 109 | + ->setTitle(_t('OptionItem.PriceModifier', 'Price')), |
|
| 110 | 110 | DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'), |
| 111 | 111 | array( |
| 112 | 112 | 'Add' => _t( |
| 113 | - 'OptionItem.PriceAdd', |
|
| 114 | - "Add to Base Price ({price})", |
|
| 115 | - 'Add to price', |
|
| 116 | - array('price' => $parentPrice) |
|
| 117 | - ), |
|
| 113 | + 'OptionItem.PriceAdd', |
|
| 114 | + "Add to Base Price ({price})", |
|
| 115 | + 'Add to price', |
|
| 116 | + array('price' => $parentPrice) |
|
| 117 | + ), |
|
| 118 | 118 | 'Subtract' => _t( |
| 119 | - 'OptionItem.PriceSubtract', |
|
| 120 | - "Subtract from Base Price ({price})", |
|
| 121 | - 'Subtract from price', |
|
| 122 | - array('price' => $parentPrice) |
|
| 123 | - ), |
|
| 119 | + 'OptionItem.PriceSubtract', |
|
| 120 | + "Subtract from Base Price ({price})", |
|
| 121 | + 'Subtract from price', |
|
| 122 | + array('price' => $parentPrice) |
|
| 123 | + ), |
|
| 124 | 124 | 'Set' => _t('OptionItem.PriceSet', 'Set as a new Price') |
| 125 | 125 | ) |
| 126 | 126 | )->setEmptyString('') |
@@ -129,28 +129,28 @@ discard block |
||
| 129 | 129 | // Code Modifier Fields |
| 130 | 130 | HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3), |
| 131 | 131 | TextField::create('CodeModifier') |
| 132 | - ->setTitle(_t('OptionItem.CodeModifier', 'Code')), |
|
| 132 | + ->setTitle(_t('OptionItem.CodeModifier', 'Code')), |
|
| 133 | 133 | DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'), |
| 134 | 134 | array( |
| 135 | 135 | 'Add' => _t( |
| 136 | - 'OptionItem.CodeAdd', |
|
| 137 | - "Add to Base Code ({code})", |
|
| 138 | - 'Add to code', |
|
| 139 | - array('code' => $parentCode) |
|
| 140 | - ), |
|
| 136 | + 'OptionItem.CodeAdd', |
|
| 137 | + "Add to Base Code ({code})", |
|
| 138 | + 'Add to code', |
|
| 139 | + array('code' => $parentCode) |
|
| 140 | + ), |
|
| 141 | 141 | 'Subtract' => _t( |
| 142 | - 'OptionItem.CodeSubtract', |
|
| 143 | - 'Subtract from Base Code ({code})', |
|
| 144 | - 'Subtract from code', |
|
| 145 | - array('code' => $parentCode) |
|
| 146 | - ), |
|
| 142 | + 'OptionItem.CodeSubtract', |
|
| 143 | + 'Subtract from Base Code ({code})', |
|
| 144 | + 'Subtract from code', |
|
| 145 | + array('code' => $parentCode) |
|
| 146 | + ), |
|
| 147 | 147 | 'Set' => _t('OptionItem.CodeSet', 'Set as a new Code') |
| 148 | 148 | ) |
| 149 | 149 | )->setEmptyString('') |
| 150 | 150 | ->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?')) |
| 151 | 151 | )); |
| 152 | 152 | |
| 153 | - /* |
|
| 153 | + /* |
|
| 154 | 154 | // Cateogry Dropdown field w/ add new |
| 155 | 155 | // removed until relevance determined |
| 156 | 156 | $categories = function(){ |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $fields->insertAfter($categoryField, 'ProductOptionGroupID'); |
| 167 | 167 | */ |
| 168 | 168 | |
| 169 | - // allow CMS fields to be extended |
|
| 169 | + // allow CMS fields to be extended |
|
| 170 | 170 | $this->extend('getCMSFields', $fields); |
| 171 | 171 | |
| 172 | 172 | return $fields; |
@@ -2,30 +2,30 @@ |
||
| 2 | 2 | |
| 3 | 3 | class OrderAddress extends DataObject { |
| 4 | 4 | |
| 5 | - private static $db = array( |
|
| 6 | - 'Name' => 'Varchar(100)', |
|
| 7 | - 'Company' => 'Varchar', |
|
| 8 | - 'Address1' => 'Varchar(200)', |
|
| 9 | - 'Address2' => 'Varchar(200)', |
|
| 10 | - 'City' => 'Varchar(100)', |
|
| 11 | - 'State' => 'Varchar(100)', |
|
| 12 | - 'PostalCode' => 'Varchar(10)', |
|
| 13 | - 'Country' => 'Varchar(100)', |
|
| 14 | - 'Phone' => 'Varchar(20)' |
|
| 15 | - ); |
|
| 16 | - |
|
| 17 | - private static $has_one = array( |
|
| 18 | - 'Order' => 'Order', |
|
| 19 | - 'Customer' => 'Member' |
|
| 20 | - ); |
|
| 21 | - |
|
| 22 | - private static $singular_name = 'Order Address'; |
|
| 23 | - private static $plural_name = 'Order Addresses'; |
|
| 24 | - private static $description = ''; |
|
| 5 | + private static $db = array( |
|
| 6 | + 'Name' => 'Varchar(100)', |
|
| 7 | + 'Company' => 'Varchar', |
|
| 8 | + 'Address1' => 'Varchar(200)', |
|
| 9 | + 'Address2' => 'Varchar(200)', |
|
| 10 | + 'City' => 'Varchar(100)', |
|
| 11 | + 'State' => 'Varchar(100)', |
|
| 12 | + 'PostalCode' => 'Varchar(10)', |
|
| 13 | + 'Country' => 'Varchar(100)', |
|
| 14 | + 'Phone' => 'Varchar(20)' |
|
| 15 | + ); |
|
| 16 | + |
|
| 17 | + private static $has_one = array( |
|
| 18 | + 'Order' => 'Order', |
|
| 19 | + 'Customer' => 'Member' |
|
| 20 | + ); |
|
| 21 | + |
|
| 22 | + private static $singular_name = 'Order Address'; |
|
| 23 | + private static $plural_name = 'Order Addresses'; |
|
| 24 | + private static $description = ''; |
|
| 25 | 25 | |
| 26 | - public function getTitle() { |
|
| 27 | - return $this->Name . ', ' . $this->Address1 . ', ' . $this->City . ' ' . $this->State . ' ' . $this->PostalCode . ' ' . $this->Country; |
|
| 28 | - } |
|
| 26 | + public function getTitle() { |
|
| 27 | + return $this->Name . ', ' . $this->Address1 . ', ' . $this->City . ' ' . $this->State . ' ' . $this->PostalCode . ' ' . $this->Country; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function getCMSFields(){ |
| 31 | 31 | $fields = parent::getCMSFields(); |