repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getAbandonedCartLimit
public function getAbandonedCartLimit() { $cartLimit = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_CART_LIMIT ); return $cartLimit; }
php
public function getAbandonedCartLimit() { $cartLimit = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_CART_LIMIT ); return $cartLimit; }
[ "public", "function", "getAbandonedCartLimit", "(", ")", "{", "$", "cartLimit", "=", "$", "this", "->", "scopeConfig", "->", "getValue", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_ABANDONED_CART_LIMIT", "...
Get the abandoned cart limit. @return boolean|string
[ "Get", "the", "abandoned", "cart", "limit", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1555-L1562
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getWebsiteSalesDataFields
public function getWebsiteSalesDataFields($website) { $subscriberDataFileds = [ 'website_name' => '', 'store_name' => '', 'number_of_orders' => '', 'average_order_value' => '', 'total_spend' => '', 'last_order_date' => '', 'last_increment_id' => '', 'most_pur_category' => '', 'most_pur_brand' => '', 'most_freq_pur_day' => '', 'most_freq_pur_mon' => '', 'first_category_pur' => '', 'last_category_pur' => '', 'first_brand_pur' => '', 'last_brand_pur' => '' ]; $store = $website->getDefaultStore(); $mappedData = $this->scopeConfig->getValue( 'connector_data_mapping/customer_data', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId() ); $mappedData = array_intersect_key($mappedData, $subscriberDataFileds); foreach ($mappedData as $key => $value) { if (!$value) { unset($mappedData[$key]); } } return $mappedData; }
php
public function getWebsiteSalesDataFields($website) { $subscriberDataFileds = [ 'website_name' => '', 'store_name' => '', 'number_of_orders' => '', 'average_order_value' => '', 'total_spend' => '', 'last_order_date' => '', 'last_increment_id' => '', 'most_pur_category' => '', 'most_pur_brand' => '', 'most_freq_pur_day' => '', 'most_freq_pur_mon' => '', 'first_category_pur' => '', 'last_category_pur' => '', 'first_brand_pur' => '', 'last_brand_pur' => '' ]; $store = $website->getDefaultStore(); $mappedData = $this->scopeConfig->getValue( 'connector_data_mapping/customer_data', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId() ); $mappedData = array_intersect_key($mappedData, $subscriberDataFileds); foreach ($mappedData as $key => $value) { if (!$value) { unset($mappedData[$key]); } } return $mappedData; }
[ "public", "function", "getWebsiteSalesDataFields", "(", "$", "website", ")", "{", "$", "subscriberDataFileds", "=", "[", "'website_name'", "=>", "''", ",", "'store_name'", "=>", "''", ",", "'number_of_orders'", "=>", "''", ",", "'average_order_value'", "=>", "''",...
Get website datafields for subscriber @param \Magento\Store\Model\Website $website @return array
[ "Get", "website", "datafields", "for", "subscriber" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1579-L1613
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.validateDateRange
public function validateDateRange($dateFrom, $dateTo) { if (!$this->validateDate($dateFrom) || !$this->validateDate($dateTo)) { return 'From or To date is not a valid date.'; } if (strtotime($dateFrom) > strtotime($dateTo)) { return 'To Date cannot be earlier then From Date.'; } return false; }
php
public function validateDateRange($dateFrom, $dateTo) { if (!$this->validateDate($dateFrom) || !$this->validateDate($dateTo)) { return 'From or To date is not a valid date.'; } if (strtotime($dateFrom) > strtotime($dateTo)) { return 'To Date cannot be earlier then From Date.'; } return false; }
[ "public", "function", "validateDateRange", "(", "$", "dateFrom", ",", "$", "dateTo", ")", "{", "if", "(", "!", "$", "this", "->", "validateDate", "(", "$", "dateFrom", ")", "||", "!", "$", "this", "->", "validateDate", "(", "$", "dateTo", ")", ")", "...
Validate date range @param string $dateFrom @param string $dateTo @return bool|string
[ "Validate", "date", "range" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1622-L1631
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getDateDifference
public function getDateDifference($created) { $now = $this->datetime->gmtDate(); return strtotime($now) - strtotime($created); }
php
public function getDateDifference($created) { $now = $this->datetime->gmtDate(); return strtotime($now) - strtotime($created); }
[ "public", "function", "getDateDifference", "(", "$", "created", ")", "{", "$", "now", "=", "$", "this", "->", "datetime", "->", "gmtDate", "(", ")", ";", "return", "strtotime", "(", "$", "now", ")", "-", "strtotime", "(", "$", "created", ")", ";", "}...
Get difference between dates @param string $created @return false|int
[ "Get", "difference", "between", "dates" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1652-L1657
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getBrandAttributeByWebsiteId
public function getBrandAttributeByWebsiteId($websiteId) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_DATA_FIELDS_BRAND_ATTRIBUTE, $websiteId ); }
php
public function getBrandAttributeByWebsiteId($websiteId) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_DATA_FIELDS_BRAND_ATTRIBUTE, $websiteId ); }
[ "public", "function", "getBrandAttributeByWebsiteId", "(", "$", "websiteId", ")", "{", "return", "$", "this", "->", "getWebsiteConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_SYNC_DATA_FIELDS_BRAND_ATTRIBUT...
Get brand attribute selected from config by website id @param int $websiteId @return string|boolean
[ "Get", "brand", "attribute", "selected", "from", "config", "by", "website", "id" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1705-L1711
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.createDatafield
public function createDatafield($website, $datafield, $type, $visibility = 'Private', $default = 'String') { $client = $this->getWebsiteApiClient($website); switch ($type) { case 'Numeric': $default = (int)$default; break; case 'Date': $default = $this->datetime->date(\Zend_Date::ISO_8601, $default); break; case 'Boolean': $default = (bool)$default; break; default: $default = (string)$default; } $response = $client->postDataFields($datafield, $type, $visibility, $default); return $response; }
php
public function createDatafield($website, $datafield, $type, $visibility = 'Private', $default = 'String') { $client = $this->getWebsiteApiClient($website); switch ($type) { case 'Numeric': $default = (int)$default; break; case 'Date': $default = $this->datetime->date(\Zend_Date::ISO_8601, $default); break; case 'Boolean': $default = (bool)$default; break; default: $default = (string)$default; } $response = $client->postDataFields($datafield, $type, $visibility, $default); return $response; }
[ "public", "function", "createDatafield", "(", "$", "website", ",", "$", "datafield", ",", "$", "type", ",", "$", "visibility", "=", "'Private'", ",", "$", "default", "=", "'String'", ")", "{", "$", "client", "=", "$", "this", "->", "getWebsiteApiClient", ...
Create data fields in account by type. @param int $website @param string $datafield @param string $type @param string $visibility @param int|boolean|string $default @return object
[ "Create", "data", "fields", "in", "account", "by", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1723-L1743
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getCanShowAdditionalSubscriptions
public function getCanShowAdditionalSubscriptions($website) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_CHANGE_BOOKS, $website ); }
php
public function getCanShowAdditionalSubscriptions($website) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_CHANGE_BOOKS, $website ); }
[ "public", "function", "getCanShowAdditionalSubscriptions", "(", "$", "website", ")", "{", "return", "$", "this", "->", "getWebsiteConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_CHANGE_...
Can show additional books? @param \Magento\Store\Model\Website|int $website @return string|boolean
[ "Can", "show", "additional", "books?" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1751-L1757
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getCanShowDataFields
public function getCanShowDataFields($website) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_SHOW_FIELDS, $website ); }
php
public function getCanShowDataFields($website) { return $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_SHOW_FIELDS, $website ); }
[ "public", "function", "getCanShowDataFields", "(", "$", "website", ")", "{", "return", "$", "this", "->", "getWebsiteConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_CAN_SHOW_FIELDS", ",",...
Can show data fields? @param \Magento\Store\Model\Website|int $website @return boolean|string
[ "Can", "show", "data", "fields?" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1765-L1771
train
dotmailer/dotmailer-magento2-extension
Helper/Data.php
Data.getAddressBookIdsToShow
public function getAddressBookIdsToShow($website) { $bookIds = $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_SHOW_BOOKS, $website ); if (empty($bookIds)) { return []; } $additionalFromConfig = explode(',', $bookIds); //unset the default option - for multi select if ($additionalFromConfig[0] == '0') { unset($additionalFromConfig[0]); } return $additionalFromConfig; }
php
public function getAddressBookIdsToShow($website) { $bookIds = $this->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_SHOW_BOOKS, $website ); if (empty($bookIds)) { return []; } $additionalFromConfig = explode(',', $bookIds); //unset the default option - for multi select if ($additionalFromConfig[0] == '0') { unset($additionalFromConfig[0]); } return $additionalFromConfig; }
[ "public", "function", "getAddressBookIdsToShow", "(", "$", "website", ")", "{", "$", "bookIds", "=", "$", "this", "->", "getWebsiteConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_SHOW_B...
Address book ids to display @param \Magento\Store\Model\Website $website @return array
[ "Address", "book", "ids", "to", "display" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1779-L1797
train
dotmailer/dotmailer-magento2-extension
Block/Recommended/Product.php
Product.getLoadedProductCollection
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); //check for param code and id if (! isset($params['order_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Product recommendation for this order not found or invalid code'); return []; } //products to be displayed for recommended pages $orderId = (int) $this->getRequest()->getParam('order_id'); //display mode based on the action name $mode = $this->getRequest()->getActionName(); $orderModel = $this->orderFactory->create(); $this->orderResource->load($orderModel, $orderId); //number of product items to be displayed $limit = $this->recommendedHelper ->getDisplayLimitByMode($mode); $orderItems = $orderModel->getAllItems(); $numItems = count($orderItems); //no product found to display if ($numItems == 0 || !$limit) { return []; } elseif ($numItems > $limit) { $maxPerChild = 1; } else { $maxPerChild = number_format($limit / $numItems); } $this->helper->log( 'DYNAMIC PRODUCTS : limit ' . $limit . ' products : ' . $numItems . ', max per child : ' . $maxPerChild ); $productsToDisplayCounter = 0; $productsToDisplay = $this->recommendedHelper->getProductsToDisplay( $orderItems, $mode, $productsToDisplayCounter, $limit, $maxPerChild ); //check for more space to fill up the table with fallback products if ($productsToDisplayCounter < $limit) { $productsToDisplay = $this->recommendedHelper->fillProductsToDisplay( $productsToDisplay, $productsToDisplayCounter, $limit ); } $this->helper->log('loaded product to display ' . count($productsToDisplay)); return $productsToDisplay; }
php
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); //check for param code and id if (! isset($params['order_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Product recommendation for this order not found or invalid code'); return []; } //products to be displayed for recommended pages $orderId = (int) $this->getRequest()->getParam('order_id'); //display mode based on the action name $mode = $this->getRequest()->getActionName(); $orderModel = $this->orderFactory->create(); $this->orderResource->load($orderModel, $orderId); //number of product items to be displayed $limit = $this->recommendedHelper ->getDisplayLimitByMode($mode); $orderItems = $orderModel->getAllItems(); $numItems = count($orderItems); //no product found to display if ($numItems == 0 || !$limit) { return []; } elseif ($numItems > $limit) { $maxPerChild = 1; } else { $maxPerChild = number_format($limit / $numItems); } $this->helper->log( 'DYNAMIC PRODUCTS : limit ' . $limit . ' products : ' . $numItems . ', max per child : ' . $maxPerChild ); $productsToDisplayCounter = 0; $productsToDisplay = $this->recommendedHelper->getProductsToDisplay( $orderItems, $mode, $productsToDisplayCounter, $limit, $maxPerChild ); //check for more space to fill up the table with fallback products if ($productsToDisplayCounter < $limit) { $productsToDisplay = $this->recommendedHelper->fillProductsToDisplay( $productsToDisplay, $productsToDisplayCounter, $limit ); } $this->helper->log('loaded product to display ' . count($productsToDisplay)); return $productsToDisplay; }
[ "public", "function", "getLoadedProductCollection", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParams", "(", ")", ";", "//check for param code and id", "if", "(", "!", "isset", "(", "$", "params", "[", "'order_id'...
Get the products to display for recommendation. @return array
[ "Get", "the", "products", "to", "display", "for", "recommendation", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Recommended/Product.php#L64-L123
train
dotmailer/dotmailer-magento2-extension
Plugin/CustomerEmailNotificationPlugin.php
CustomerEmailNotificationPlugin.getWebsiteStoreId
private function getWebsiteStoreId($customer, $defaultStoreId = null) { if ($customer->getWebsiteId() != 0 && empty($defaultStoreId)) { $storeIds = $this->storeManager->getWebsite($customer->getWebsiteId())->getStoreIds(); $defaultStoreId = reset($storeIds); } return $defaultStoreId; }
php
private function getWebsiteStoreId($customer, $defaultStoreId = null) { if ($customer->getWebsiteId() != 0 && empty($defaultStoreId)) { $storeIds = $this->storeManager->getWebsite($customer->getWebsiteId())->getStoreIds(); $defaultStoreId = reset($storeIds); } return $defaultStoreId; }
[ "private", "function", "getWebsiteStoreId", "(", "$", "customer", ",", "$", "defaultStoreId", "=", "null", ")", "{", "if", "(", "$", "customer", "->", "getWebsiteId", "(", ")", "!=", "0", "&&", "empty", "(", "$", "defaultStoreId", ")", ")", "{", "$", "...
Get either first store ID from a set website or the provided as default @param \Magento\Customer\Api\Data\CustomerInterface $customer @param int|string|null $defaultStoreId @return int
[ "Get", "either", "first", "store", "ID", "from", "a", "set", "website", "or", "the", "provided", "as", "default" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Plugin/CustomerEmailNotificationPlugin.php#L75-L82
train
dotmailer/dotmailer-magento2-extension
Block/Recommended/Mostviewed.php
Mostviewed.getLoadedProductCollection
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Most viewed no valid code is set'); return []; } $productsToDisplay = []; $mode = $this->getRequest()->getActionName(); $limit = $this->recommnededHelper->getDisplayLimitByMode($mode); $from = $this->recommnededHelper->getTimeFromConfig($mode); $to = $this->_localeDate->date()->format(\Zend_Date::ISO_8601); $catId = $this->getRequest()->getParam('category_id'); $catName = $this->getRequest()->getParam('category_name'); $reportProductCollection = $this->catalog->getMostViewedProductCollection($from, $to, $limit, $catId, $catName); //product ids from the report product collection $productIds = $reportProductCollection->getColumnValues('entity_id'); $productCollection = $this->catalog->getProductCollectionFromIds($productIds); //product collection foreach ($productCollection as $_product) { //add only saleable products if ($_product->isSalable()) { $productsToDisplay[] = $_product; } } return $productsToDisplay; }
php
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Most viewed no valid code is set'); return []; } $productsToDisplay = []; $mode = $this->getRequest()->getActionName(); $limit = $this->recommnededHelper->getDisplayLimitByMode($mode); $from = $this->recommnededHelper->getTimeFromConfig($mode); $to = $this->_localeDate->date()->format(\Zend_Date::ISO_8601); $catId = $this->getRequest()->getParam('category_id'); $catName = $this->getRequest()->getParam('category_name'); $reportProductCollection = $this->catalog->getMostViewedProductCollection($from, $to, $limit, $catId, $catName); //product ids from the report product collection $productIds = $reportProductCollection->getColumnValues('entity_id'); $productCollection = $this->catalog->getProductCollectionFromIds($productIds); //product collection foreach ($productCollection as $_product) { //add only saleable products if ($_product->isSalable()) { $productsToDisplay[] = $_product; } } return $productsToDisplay; }
[ "public", "function", "getLoadedProductCollection", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParams", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "params", "[", "'code'", "]", ")", "||", "!", "$", ...
Get product collection. @return array
[ "Get", "product", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Recommended/Mostviewed.php#L65-L97
train
dotmailer/dotmailer-magento2-extension
Model/Trial/TrialSetup.php
TrialSetup.saveApiCreds
public function saveApiCreds($apiUser, $apiPass) { $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_USERNAME, $apiUser, 'default', 0 ); //Save encrypted password $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_PASSWORD, $this->helper->encryptor->encrypt($apiPass), 'default', 0 ); //Clear config cache $this->config->reinit(); return true; }
php
public function saveApiCreds($apiUser, $apiPass) { $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_USERNAME, $apiUser, 'default', 0 ); //Save encrypted password $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_API_PASSWORD, $this->helper->encryptor->encrypt($apiPass), 'default', 0 ); //Clear config cache $this->config->reinit(); return true; }
[ "public", "function", "saveApiCreds", "(", "$", "apiUser", ",", "$", "apiPass", ")", "{", "$", "this", "->", "helper", "->", "saveConfigData", "(", "Config", "::", "XML_PATH_CONNECTOR_API_ENABLED", ",", "'1'", ",", "'default'", ",", "0", ")", ";", "$", "th...
Save api credentioals. @param string $apiUser @param string $apiPass @return bool
[ "Save", "api", "credentioals", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Trial/TrialSetup.php#L76-L103
train
dotmailer/dotmailer-magento2-extension
Model/Trial/TrialSetup.php
TrialSetup.setupDataFields
public function setupDataFields($username, $password) { $error = false; $apiModel = false; if ($this->helper->isEnabled()) { $apiModel = $this->helper->getWebsiteApiClient(0, $username, $password); } if (!$apiModel) { $error = true; $this->helper->log('setupDataFields client is not enabled'); } else { //validate account $accountInfo = $apiModel->getAccountInfo(); if (isset($accountInfo->message)) { $this->helper->log('setupDataFields ' . $accountInfo->message); $error = true; } else { $dataFields = $this->dataField->getContactDatafields(); foreach ($dataFields as $key => $dataField) { $apiModel->postDataFields($dataField); //map the successfully created data field $this->helper->saveConfigData( 'connector_data_mapping/customer_data/' . $key, strtoupper($dataField['name']), 'default', 0 ); $this->helper->log('setupDataFields successfully connected : ' . $dataField['name']); } } } return $error == true ? false : true; }
php
public function setupDataFields($username, $password) { $error = false; $apiModel = false; if ($this->helper->isEnabled()) { $apiModel = $this->helper->getWebsiteApiClient(0, $username, $password); } if (!$apiModel) { $error = true; $this->helper->log('setupDataFields client is not enabled'); } else { //validate account $accountInfo = $apiModel->getAccountInfo(); if (isset($accountInfo->message)) { $this->helper->log('setupDataFields ' . $accountInfo->message); $error = true; } else { $dataFields = $this->dataField->getContactDatafields(); foreach ($dataFields as $key => $dataField) { $apiModel->postDataFields($dataField); //map the successfully created data field $this->helper->saveConfigData( 'connector_data_mapping/customer_data/' . $key, strtoupper($dataField['name']), 'default', 0 ); $this->helper->log('setupDataFields successfully connected : ' . $dataField['name']); } } } return $error == true ? false : true; }
[ "public", "function", "setupDataFields", "(", "$", "username", ",", "$", "password", ")", "{", "$", "error", "=", "false", ";", "$", "apiModel", "=", "false", ";", "if", "(", "$", "this", "->", "helper", "->", "isEnabled", "(", ")", ")", "{", "$", ...
Setup data fields. @param string $username @param string $password @return bool
[ "Setup", "data", "fields", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Trial/TrialSetup.php#L113-L146
train
dotmailer/dotmailer-magento2-extension
Model/Trial/TrialSetup.php
TrialSetup.createAddressBooks
public function createAddressBooks($username, $password) { $addressBooks = [ ['name' => 'Magento_Customers', 'visibility' => 'Private'], ['name' => 'Magento_Subscribers', 'visibility' => 'Private'], ['name' => 'Magento_Guests', 'visibility' => 'Private'], ]; $client = false; if ($this->helper->isEnabled()) { $client = $this->helper->getWebsiteApiClient(0, $username, $password); } if (!$client) { $error = true; $this->helper->log('createAddressBooks client is not enabled'); } else { $error = $this->validateAccountAndCreateAddressbooks($client, $addressBooks); } return $error == true ? false : true; }
php
public function createAddressBooks($username, $password) { $addressBooks = [ ['name' => 'Magento_Customers', 'visibility' => 'Private'], ['name' => 'Magento_Subscribers', 'visibility' => 'Private'], ['name' => 'Magento_Guests', 'visibility' => 'Private'], ]; $client = false; if ($this->helper->isEnabled()) { $client = $this->helper->getWebsiteApiClient(0, $username, $password); } if (!$client) { $error = true; $this->helper->log('createAddressBooks client is not enabled'); } else { $error = $this->validateAccountAndCreateAddressbooks($client, $addressBooks); } return $error == true ? false : true; }
[ "public", "function", "createAddressBooks", "(", "$", "username", ",", "$", "password", ")", "{", "$", "addressBooks", "=", "[", "[", "'name'", "=>", "'Magento_Customers'", ",", "'visibility'", "=>", "'Private'", "]", ",", "[", "'name'", "=>", "'Magento_Subscr...
Create certain address books. @param string $username @param string $password @return bool
[ "Create", "certain", "address", "books", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Trial/TrialSetup.php#L156-L175
train
dotmailer/dotmailer-magento2-extension
Model/Trial/TrialSetup.php
TrialSetup.mapAddressBook
public function mapAddressBook($name, $id) { $addressBookMap = [ 'Magento_Customers' => Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID, 'Magento_Subscribers' => Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID, 'Magento_Guests' => Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID, ]; $this->helper->saveConfigData($addressBookMap[$name], $id, 'default', 0); $this->helper->log('successfully connected address book : ' . $name); }
php
public function mapAddressBook($name, $id) { $addressBookMap = [ 'Magento_Customers' => Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID, 'Magento_Subscribers' => Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID, 'Magento_Guests' => Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID, ]; $this->helper->saveConfigData($addressBookMap[$name], $id, 'default', 0); $this->helper->log('successfully connected address book : ' . $name); }
[ "public", "function", "mapAddressBook", "(", "$", "name", ",", "$", "id", ")", "{", "$", "addressBookMap", "=", "[", "'Magento_Customers'", "=>", "Config", "::", "XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID", ",", "'Magento_Subscribers'", "=>", "Config", "::", "XML...
Map the successfully created address book @param string $name @param int $id @return null
[ "Map", "the", "successfully", "created", "address", "book" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Trial/TrialSetup.php#L185-L195
train
dotmailer/dotmailer-magento2-extension
Model/Trial/TrialSetup.php
TrialSetup.enableSyncForTrial
public function enableSyncForTrial() { $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_CUSTOMER_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_GUEST_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, '1', 'default', 0 ); //Clear config cache $this->config->reinit(); return true; }
php
public function enableSyncForTrial() { $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_CUSTOMER_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_GUEST_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED, '1', 'default', 0 ); $this->helper->saveConfigData( Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, '1', 'default', 0 ); //Clear config cache $this->config->reinit(); return true; }
[ "public", "function", "enableSyncForTrial", "(", ")", "{", "$", "this", "->", "helper", "->", "saveConfigData", "(", "Config", "::", "XML_PATH_CONNECTOR_SYNC_CUSTOMER_ENABLED", ",", "'1'", ",", "'default'", ",", "0", ")", ";", "$", "this", "->", "helper", "->"...
Enable certain syncs for newly created trial account. @return bool
[ "Enable", "certain", "syncs", "for", "newly", "created", "trial", "account", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Trial/TrialSetup.php#L202-L233
train
dotmailer/dotmailer-magento2-extension
Controller/Customer/Newsletter.php
Newsletter.processGeneralSubscription
private function processGeneralSubscription() { $customerId = $this->customerSession->getCustomerId(); if ($customerId === null) { $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } else { try { $customer = $this->customerRepository->getById($customerId); $storeId = $this->helper->storeManager->getStore()->getId(); $customer->setStoreId($storeId); $isSubscribedState = $customer->getExtensionAttributes() ->getIsSubscribed(); $isSubscribedParam = (boolean)$this->getRequest() ->getParam('is_subscribed', false); if ($isSubscribedParam !== $isSubscribedState) { $this->customerRepository->save($customer); if ($isSubscribedParam) { $subscribeModel = $this->subscriberFactory->create() ->subscribeCustomerById($customerId); $subscribeStatus = $subscribeModel->getStatus(); if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) { $this->messageManager->addSuccess(__('We have saved your subscription.')); } else { $this->messageManager->addSuccess(__('A confirmation request has been sent.')); } } else { $this->subscriberFactory->create() ->unsubscribeCustomerById($customerId); $this->messageManager->addSuccess(__('We have removed your newsletter subscription.')); } } else { $this->messageManager->addSuccess(__('We have updated your subscription.')); } } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } } }
php
private function processGeneralSubscription() { $customerId = $this->customerSession->getCustomerId(); if ($customerId === null) { $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } else { try { $customer = $this->customerRepository->getById($customerId); $storeId = $this->helper->storeManager->getStore()->getId(); $customer->setStoreId($storeId); $isSubscribedState = $customer->getExtensionAttributes() ->getIsSubscribed(); $isSubscribedParam = (boolean)$this->getRequest() ->getParam('is_subscribed', false); if ($isSubscribedParam !== $isSubscribedState) { $this->customerRepository->save($customer); if ($isSubscribedParam) { $subscribeModel = $this->subscriberFactory->create() ->subscribeCustomerById($customerId); $subscribeStatus = $subscribeModel->getStatus(); if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) { $this->messageManager->addSuccess(__('We have saved your subscription.')); } else { $this->messageManager->addSuccess(__('A confirmation request has been sent.')); } } else { $this->subscriberFactory->create() ->unsubscribeCustomerById($customerId); $this->messageManager->addSuccess(__('We have removed your newsletter subscription.')); } } else { $this->messageManager->addSuccess(__('We have updated your subscription.')); } } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } } }
[ "private", "function", "processGeneralSubscription", "(", ")", "{", "$", "customerId", "=", "$", "this", "->", "customerSession", "->", "getCustomerId", "(", ")", ";", "if", "(", "$", "customerId", "===", "null", ")", "{", "$", "this", "->", "messageManager"...
Process general subscription
[ "Process", "general", "subscription" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Customer/Newsletter.php#L401-L438
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.moveFile
private function moveFile($sourceFolder, $destFolder, $filename) { // generate the full file paths $sourceFilepath = $sourceFolder . DIRECTORY_SEPARATOR . $filename; $destFilepath = $destFolder . DIRECTORY_SEPARATOR . $filename; // rename the file rename($sourceFilepath, $destFilepath); }
php
private function moveFile($sourceFolder, $destFolder, $filename) { // generate the full file paths $sourceFilepath = $sourceFolder . DIRECTORY_SEPARATOR . $filename; $destFilepath = $destFolder . DIRECTORY_SEPARATOR . $filename; // rename the file rename($sourceFilepath, $destFilepath); }
[ "private", "function", "moveFile", "(", "$", "sourceFolder", ",", "$", "destFolder", ",", "$", "filename", ")", "{", "// generate the full file paths", "$", "sourceFilepath", "=", "$", "sourceFolder", ".", "DIRECTORY_SEPARATOR", ".", "$", "filename", ";", "$", "...
Moves the output file from one folder to the next. @param string $sourceFolder @param string $destFolder @param string $filename @return null
[ "Moves", "the", "output", "file", "from", "one", "folder", "to", "the", "next", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L142-L150
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.outputForceQuotesCSV
public function outputForceQuotesCSV($filepath, $csv) { $fqCsv = $this->arrayToCsv($csv, chr(9), '"', true, false); // Open for writing only; place the file pointer at the end of the file. // If the file does not exist, attempt to create it. $fp = fopen($filepath, 'a'); // for some reason passing the preset delimiter/enclosure variables results in error // $this->delimiter $this->enclosure if (fwrite($fp, $fqCsv) == 0) { throw new \Exception('Problem writing CSV file'); } fclose($fp); }
php
public function outputForceQuotesCSV($filepath, $csv) { $fqCsv = $this->arrayToCsv($csv, chr(9), '"', true, false); // Open for writing only; place the file pointer at the end of the file. // If the file does not exist, attempt to create it. $fp = fopen($filepath, 'a'); // for some reason passing the preset delimiter/enclosure variables results in error // $this->delimiter $this->enclosure if (fwrite($fp, $fqCsv) == 0) { throw new \Exception('Problem writing CSV file'); } fclose($fp); }
[ "public", "function", "outputForceQuotesCSV", "(", "$", "filepath", ",", "$", "csv", ")", "{", "$", "fqCsv", "=", "$", "this", "->", "arrayToCsv", "(", "$", "csv", ",", "chr", "(", "9", ")", ",", "'\"'", ",", "true", ",", "false", ")", ";", "// Ope...
Output an array to the output file FORCING Quotes around all fields. @param string $filepath @param mixed $csv @throws \Exception @return null
[ "Output", "an", "array", "to", "the", "output", "file", "FORCING", "Quotes", "around", "all", "fields", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L162-L175
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.arrayToCsv
private function arrayToCsv( array &$fields, $delimiter, $enclosure, $encloseAll = false, $nullToMysqlNull = false ) { $delimiterEsc = preg_quote($delimiter, '/'); $enclosureEsc = preg_quote($enclosure, '/'); $output = []; foreach ($fields as $field) { if ($field === null && $nullToMysqlNull) { $output[] = 'NULL'; continue; } // Enclose fields containing $delimiter, $enclosure or whitespace if ($encloseAll || preg_match( "/(?:$delimiterEsc|$enclosureEsc|\s)/", $field ) ) { $output[] = $enclosure . str_replace( $enclosure, $enclosure . $enclosure, $field ) . $enclosure; } else { $output[] = $field; } } return implode($delimiter, $output) . "\n"; }
php
private function arrayToCsv( array &$fields, $delimiter, $enclosure, $encloseAll = false, $nullToMysqlNull = false ) { $delimiterEsc = preg_quote($delimiter, '/'); $enclosureEsc = preg_quote($enclosure, '/'); $output = []; foreach ($fields as $field) { if ($field === null && $nullToMysqlNull) { $output[] = 'NULL'; continue; } // Enclose fields containing $delimiter, $enclosure or whitespace if ($encloseAll || preg_match( "/(?:$delimiterEsc|$enclosureEsc|\s)/", $field ) ) { $output[] = $enclosure . str_replace( $enclosure, $enclosure . $enclosure, $field ) . $enclosure; } else { $output[] = $field; } } return implode($delimiter, $output) . "\n"; }
[ "private", "function", "arrayToCsv", "(", "array", "&", "$", "fields", ",", "$", "delimiter", ",", "$", "enclosure", ",", "$", "encloseAll", "=", "false", ",", "$", "nullToMysqlNull", "=", "false", ")", "{", "$", "delimiterEsc", "=", "preg_quote", "(", "...
Convert array into the csv. @param array $fields @param string $delimiter @param string $enclosure @param bool $encloseAll @param bool $nullToMysqlNull @return string
[ "Convert", "array", "into", "the", "csv", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L219-L254
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.deleteDir
public function deleteDir($path) { if (strpos($path, $this->directoryList->getPath('var')) === false) { return sprintf("Failed to delete directory - '%s'", $path); } $classFunc = [__CLASS__, __FUNCTION__]; return is_file($path) ? @unlink($path) : array_map($classFunc, glob($path . '/*')) == @rmdir($path); }
php
public function deleteDir($path) { if (strpos($path, $this->directoryList->getPath('var')) === false) { return sprintf("Failed to delete directory - '%s'", $path); } $classFunc = [__CLASS__, __FUNCTION__]; return is_file($path) ? @unlink($path) : array_map($classFunc, glob($path . '/*')) == @rmdir($path); }
[ "public", "function", "deleteDir", "(", "$", "path", ")", "{", "if", "(", "strpos", "(", "$", "path", ",", "$", "this", "->", "directoryList", "->", "getPath", "(", "'var'", ")", ")", "===", "false", ")", "{", "return", "sprintf", "(", "\"Failed to del...
Delete file or directory. @param string $path @return bool
[ "Delete", "file", "or", "directory", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L263-L275
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.getLogFileContent
public function getLogFileContent($filename = 'connector') { switch ($filename) { case "connector": $filename = 'connector.log'; break; case "system": $filename = 'system.log'; break; case "exception": $filename = 'exception.log'; break; case "debug": $filename = 'debug.log'; break; default: return "Log file is not valid. Log file name is " . $filename; } $pathLogfile = $this->directoryList->getPath('log') . DIRECTORY_SEPARATOR . $filename; //tail the length file content $lengthBefore = 500000; try { $contents = ''; $handle = fopen($pathLogfile, 'r'); fseek($handle, -$lengthBefore, SEEK_END); if (!$handle) { return "Log file is not readable or does not exist at this moment. File path is " . $pathLogfile; } if (filesize($pathLogfile) > 0) { $contents = fread($handle, filesize($pathLogfile)); if ($contents === false) { return "Log file is not readable or does not exist at this moment. File path is " . $pathLogfile; } fclose($handle); } return $contents; } catch (\Exception $e) { return $e->getMessage() . $pathLogfile; } }
php
public function getLogFileContent($filename = 'connector') { switch ($filename) { case "connector": $filename = 'connector.log'; break; case "system": $filename = 'system.log'; break; case "exception": $filename = 'exception.log'; break; case "debug": $filename = 'debug.log'; break; default: return "Log file is not valid. Log file name is " . $filename; } $pathLogfile = $this->directoryList->getPath('log') . DIRECTORY_SEPARATOR . $filename; //tail the length file content $lengthBefore = 500000; try { $contents = ''; $handle = fopen($pathLogfile, 'r'); fseek($handle, -$lengthBefore, SEEK_END); if (!$handle) { return "Log file is not readable or does not exist at this moment. File path is " . $pathLogfile; } if (filesize($pathLogfile) > 0) { $contents = fread($handle, filesize($pathLogfile)); if ($contents === false) { return "Log file is not readable or does not exist at this moment. File path is " . $pathLogfile; } fclose($handle); } return $contents; } catch (\Exception $e) { return $e->getMessage() . $pathLogfile; } }
[ "public", "function", "getLogFileContent", "(", "$", "filename", "=", "'connector'", ")", "{", "switch", "(", "$", "filename", ")", "{", "case", "\"connector\"", ":", "$", "filename", "=", "'connector.log'", ";", "break", ";", "case", "\"system\"", ":", "$",...
Get log file content. @param string $filename @return string
[ "Get", "log", "file", "content", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L284-L326
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.getFilePathWithFallback
public function getFilePathWithFallback($filename) { $emailPath = $this->getOutputFolder() . DIRECTORY_SEPARATOR . $filename; $archivePath = $this->getArchiveFolder() . DIRECTORY_SEPARATOR . $filename; return is_file($emailPath) ? $emailPath : $archivePath; }
php
public function getFilePathWithFallback($filename) { $emailPath = $this->getOutputFolder() . DIRECTORY_SEPARATOR . $filename; $archivePath = $this->getArchiveFolder() . DIRECTORY_SEPARATOR . $filename; return is_file($emailPath) ? $emailPath : $archivePath; }
[ "public", "function", "getFilePathWithFallback", "(", "$", "filename", ")", "{", "$", "emailPath", "=", "$", "this", "->", "getOutputFolder", "(", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "filename", ";", "$", "archivePath", "=", "$", "this", "->", "getArc...
Return the full file path with checking in archive as fallback. @param string $filename @return string
[ "Return", "the", "full", "file", "path", "with", "checking", "in", "archive", "as", "fallback", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L381-L386
train
dotmailer/dotmailer-magento2-extension
Helper/File.php
File.isFilePathExistWithFallback
public function isFilePathExistWithFallback($filename) { $emailPath = $this->getOutputFolder() . DIRECTORY_SEPARATOR . $filename; $archivePath = $this->getArchiveFolder() . DIRECTORY_SEPARATOR . $filename; return is_file($emailPath) ? true : (is_file($archivePath) ? true : false); }
php
public function isFilePathExistWithFallback($filename) { $emailPath = $this->getOutputFolder() . DIRECTORY_SEPARATOR . $filename; $archivePath = $this->getArchiveFolder() . DIRECTORY_SEPARATOR . $filename; return is_file($emailPath) ? true : (is_file($archivePath) ? true : false); }
[ "public", "function", "isFilePathExistWithFallback", "(", "$", "filename", ")", "{", "$", "emailPath", "=", "$", "this", "->", "getOutputFolder", "(", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "filename", ";", "$", "archivePath", "=", "$", "this", "->", "ge...
Check if file exist in email or archive folder @param string $filename @return boolean
[ "Check", "if", "file", "exist", "in", "email", "or", "archive", "folder" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/File.php#L394-L399
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Type.php
Type.getInputType
public function getInputType($attribute) { switch ($attribute) { case 'subtotal': case 'grand_total': case 'items_qty': return 'numeric'; case 'method': case 'shipping_method': case 'country_id': case 'region_id': case 'customer_group_id': return 'select'; default: $attribute = $this->configFactory->getAttribute( 'catalog_product', $attribute ); return $this->processAttribute($attribute); } }
php
public function getInputType($attribute) { switch ($attribute) { case 'subtotal': case 'grand_total': case 'items_qty': return 'numeric'; case 'method': case 'shipping_method': case 'country_id': case 'region_id': case 'customer_group_id': return 'select'; default: $attribute = $this->configFactory->getAttribute( 'catalog_product', $attribute ); return $this->processAttribute($attribute); } }
[ "public", "function", "getInputType", "(", "$", "attribute", ")", "{", "switch", "(", "$", "attribute", ")", "{", "case", "'subtotal'", ":", "case", "'grand_total'", ":", "case", "'items_qty'", ":", "return", "'numeric'", ";", "case", "'method'", ":", "case"...
Default options. @param string $attribute @return string
[ "Default", "options", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Type.php#L38-L60
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Type.php
Type.toOptionArray
public function toOptionArray() { $defaultOptions = $this->defaultOptions(); $productCondition = $this->productFactory; $productAttributes = $productCondition->loadAttributeOptions() ->getAttributeOption(); $pAttributes = []; foreach ($productAttributes as $code => $label) { if (strpos($code, 'quote_item_') === false) { $pAttributes[$code] = $label; } } $options = array_merge($defaultOptions, $pAttributes); return $options; }
php
public function toOptionArray() { $defaultOptions = $this->defaultOptions(); $productCondition = $this->productFactory; $productAttributes = $productCondition->loadAttributeOptions() ->getAttributeOption(); $pAttributes = []; foreach ($productAttributes as $code => $label) { if (strpos($code, 'quote_item_') === false) { $pAttributes[$code] = $label; } } $options = array_merge($defaultOptions, $pAttributes); return $options; }
[ "public", "function", "toOptionArray", "(", ")", "{", "$", "defaultOptions", "=", "$", "this", "->", "defaultOptions", "(", ")", ";", "$", "productCondition", "=", "$", "this", "->", "productFactory", ";", "$", "productAttributes", "=", "$", "productCondition"...
Attribute options array. @return array
[ "Attribute", "options", "array", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Type.php#L106-L121
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Importer.php
Importer.massResend
public function massResend($ids) { try { $conn = $this->getConnection(); $num = $conn->update( $this->getTable(Schema::EMAIL_IMPORTER_TABLE), ['import_status' => 0], ['id IN(?)' => $ids] ); return $num; } catch (\Exception $e) { return $e->getMessage(); } }
php
public function massResend($ids) { try { $conn = $this->getConnection(); $num = $conn->update( $this->getTable(Schema::EMAIL_IMPORTER_TABLE), ['import_status' => 0], ['id IN(?)' => $ids] ); return $num; } catch (\Exception $e) { return $e->getMessage(); } }
[ "public", "function", "massResend", "(", "$", "ids", ")", "{", "try", "{", "$", "conn", "=", "$", "this", "->", "getConnection", "(", ")", ";", "$", "num", "=", "$", "conn", "->", "update", "(", "$", "this", "->", "getTable", "(", "Schema", "::", ...
Reset importer items. @param array $ids @return int|string
[ "Reset", "importer", "items", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Importer.php#L53-L67
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Importer.php
Importer.cleanup
public function cleanup($tableName) { try { $interval = $this->dateIntervalFactory->create(['interval_spec' => 'P30D']); $date = $this->localeDate->date()->sub($interval)->format('Y-m-d H:i:s'); $conn = $this->getConnection(); $num = $conn->delete( $this->getTable($tableName), ['created_at < ?' => $date] ); return $num; } catch (\Exception $e) { return $e->getMessage(); } }
php
public function cleanup($tableName) { try { $interval = $this->dateIntervalFactory->create(['interval_spec' => 'P30D']); $date = $this->localeDate->date()->sub($interval)->format('Y-m-d H:i:s'); $conn = $this->getConnection(); $num = $conn->delete( $this->getTable($tableName), ['created_at < ?' => $date] ); return $num; } catch (\Exception $e) { return $e->getMessage(); } }
[ "public", "function", "cleanup", "(", "$", "tableName", ")", "{", "try", "{", "$", "interval", "=", "$", "this", "->", "dateIntervalFactory", "->", "create", "(", "[", "'interval_spec'", "=>", "'P30D'", "]", ")", ";", "$", "date", "=", "$", "this", "->...
Delete completed records older then 30 days from provided table. @param string $tableName @return \Exception|int
[ "Delete", "completed", "records", "older", "then", "30", "days", "from", "provided", "table", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Importer.php#L76-L91
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Campaign/Collection.php
Collection.getExpiredEmailCampaignsByStoreIds
public function getExpiredEmailCampaignsByStoreIds($storeIds) { $time = new \DateTime('now', new \DateTimezone('UTC')); $interval = $this->dateIntervalFactory->create( ['interval_spec' => sprintf('PT%sH', 2)] ); $time->sub($interval); $campaignCollection = $this->addFieldToFilter('campaign_id', ['notnull' => true]) ->addFieldToFilter('send_status', \Dotdigitalgroup\Email\Model\Campaign::PROCESSING) ->addFieldToFilter('store_id', ['in' => $storeIds]) ->addFieldToFilter('send_id', ['notnull' => true]) ->addFieldToFilter('updated_at', ['lt' => $time->format('Y-m-d H:i:s')]); return $campaignCollection; }
php
public function getExpiredEmailCampaignsByStoreIds($storeIds) { $time = new \DateTime('now', new \DateTimezone('UTC')); $interval = $this->dateIntervalFactory->create( ['interval_spec' => sprintf('PT%sH', 2)] ); $time->sub($interval); $campaignCollection = $this->addFieldToFilter('campaign_id', ['notnull' => true]) ->addFieldToFilter('send_status', \Dotdigitalgroup\Email\Model\Campaign::PROCESSING) ->addFieldToFilter('store_id', ['in' => $storeIds]) ->addFieldToFilter('send_id', ['notnull' => true]) ->addFieldToFilter('updated_at', ['lt' => $time->format('Y-m-d H:i:s')]); return $campaignCollection; }
[ "public", "function", "getExpiredEmailCampaignsByStoreIds", "(", "$", "storeIds", ")", "{", "$", "time", "=", "new", "\\", "DateTime", "(", "'now'", ",", "new", "\\", "DateTimezone", "(", "'UTC'", ")", ")", ";", "$", "interval", "=", "$", "this", "->", "...
Get expired campaigns by store ids @param array $storeIds @return Collection
[ "Get", "expired", "campaigns", "by", "store", "ids" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Campaign/Collection.php#L113-L128
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Campaign/Collection.php
Collection.getNumberOfCampaignsForContactByInterval
public function getNumberOfCampaignsForContactByInterval($email, $updated) { return $this->addFieldToFilter('email', $email) ->addFieldToFilter('event_name', 'Lost Basket') ->addFieldToFilter('sent_at', $updated) ->count(); }
php
public function getNumberOfCampaignsForContactByInterval($email, $updated) { return $this->addFieldToFilter('email', $email) ->addFieldToFilter('event_name', 'Lost Basket') ->addFieldToFilter('sent_at', $updated) ->count(); }
[ "public", "function", "getNumberOfCampaignsForContactByInterval", "(", "$", "email", ",", "$", "updated", ")", "{", "return", "$", "this", "->", "addFieldToFilter", "(", "'email'", ",", "$", "email", ")", "->", "addFieldToFilter", "(", "'event_name'", ",", "'Los...
Get number of campaigns for contact by interval. @param string $email @param array $updated @return int
[ "Get", "number", "of", "campaigns", "for", "contact", "by", "interval", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Campaign/Collection.php#L150-L156
train
dotmailer/dotmailer-magento2-extension
Model/Sales/CouponGridFilterer.php
CouponGridFilterer.filterByGeneratedByDotmailer
public function filterByGeneratedByDotmailer($collection, $column) { $field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex(); $value = $column->getFilter()->getValue(); if ($value == 'null') { $collection->addFieldToFilter($field, ['null' => true]); } else { $collection->addFieldToFilter($field, ['notnull' => true]); } }
php
public function filterByGeneratedByDotmailer($collection, $column) { $field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex(); $value = $column->getFilter()->getValue(); if ($value == 'null') { $collection->addFieldToFilter($field, ['null' => true]); } else { $collection->addFieldToFilter($field, ['notnull' => true]); } }
[ "public", "function", "filterByGeneratedByDotmailer", "(", "$", "collection", ",", "$", "column", ")", "{", "$", "field", "=", "$", "column", "->", "getFilterIndex", "(", ")", "?", "$", "column", "->", "getFilterIndex", "(", ")", ":", "$", "column", "->", ...
Callback action for cart price rule coupon grid. @param AbstractCollection $collection @param Column $column @return void
[ "Callback", "action", "for", "cart", "price", "rule", "coupon", "grid", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sales/CouponGridFilterer.php#L14-L24
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Automation/Collection.php
Collection.getAutomationStatusType
public function getAutomationStatusType() { $automationOrderStatusCollection = $this->addFieldToFilter( 'enrolment_status', \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING ); $automationOrderStatusCollection ->addFieldToFilter( 'automation_type', ['like' => '%' . \Dotdigitalgroup\Email\Model\Sync\Automation::ORDER_STATUS_AUTOMATION . '%'] )->getSelect() ->group('automation_type'); return $automationOrderStatusCollection->getColumnValues('automation_type'); }
php
public function getAutomationStatusType() { $automationOrderStatusCollection = $this->addFieldToFilter( 'enrolment_status', \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING ); $automationOrderStatusCollection ->addFieldToFilter( 'automation_type', ['like' => '%' . \Dotdigitalgroup\Email\Model\Sync\Automation::ORDER_STATUS_AUTOMATION . '%'] )->getSelect() ->group('automation_type'); return $automationOrderStatusCollection->getColumnValues('automation_type'); }
[ "public", "function", "getAutomationStatusType", "(", ")", "{", "$", "automationOrderStatusCollection", "=", "$", "this", "->", "addFieldToFilter", "(", "'enrolment_status'", ",", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Model", "\\", "Sync", "\\", "Automation...
Get automation status type @return array
[ "Get", "automation", "status", "type" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Automation/Collection.php#L31-L45
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Automation/Collection.php
Collection.getCollectionByType
public function getCollectionByType($type, $limit) { $collection = $this->addFieldToFilter( 'enrolment_status', [ 'in' => [ \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING, \Dotdigitalgroup\Email\Model\Sync\Automation::CONTACT_STATUS_CONFIRMED ] ] )->addFieldToFilter( 'automation_type', $type ); //limit because of the each contact request to get the id $collection->getSelect()->limit($limit); return $collection; }
php
public function getCollectionByType($type, $limit) { $collection = $this->addFieldToFilter( 'enrolment_status', [ 'in' => [ \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING, \Dotdigitalgroup\Email\Model\Sync\Automation::CONTACT_STATUS_CONFIRMED ] ] )->addFieldToFilter( 'automation_type', $type ); //limit because of the each contact request to get the id $collection->getSelect()->limit($limit); return $collection; }
[ "public", "function", "getCollectionByType", "(", "$", "type", ",", "$", "limit", ")", "{", "$", "collection", "=", "$", "this", "->", "addFieldToFilter", "(", "'enrolment_status'", ",", "[", "'in'", "=>", "[", "\\", "Dotdigitalgroup", "\\", "Email", "\\", ...
Get collection by type. @param string $type @param string $limit @return $this
[ "Get", "collection", "by", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Automation/Collection.php#L55-L73
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Contact/Collection.php
Collection.getContactsToImportForWebsite
public function getContactsToImportForWebsite($websiteId, $pageSize = 100) { $collection = $this->addFieldToFilter('website_id', $websiteId) ->addFieldToFilter('email_imported', ['null' => true]) ->addFieldToFilter('customer_id', ['neq' => '0']); $collection->getSelect()->limit($pageSize); return $collection; }
php
public function getContactsToImportForWebsite($websiteId, $pageSize = 100) { $collection = $this->addFieldToFilter('website_id', $websiteId) ->addFieldToFilter('email_imported', ['null' => true]) ->addFieldToFilter('customer_id', ['neq' => '0']); $collection->getSelect()->limit($pageSize); return $collection; }
[ "public", "function", "getContactsToImportForWebsite", "(", "$", "websiteId", ",", "$", "pageSize", "=", "100", ")", "{", "$", "collection", "=", "$", "this", "->", "addFieldToFilter", "(", "'website_id'", ",", "$", "websiteId", ")", "->", "addFieldToFilter", ...
Get all customer contacts not imported for a website. @param int $websiteId @param int $pageSize @return $this
[ "Get", "all", "customer", "contacts", "not", "imported", "for", "a", "website", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Contact/Collection.php#L87-L96
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Contact/Collection.php
Collection.getMissingContacts
public function getMissingContacts($websiteId, $pageSize = 100) { $collection = $this->addFieldToFilter('contact_id', ['null' => true]) ->addFieldToFilter('suppressed', ['null' => true]) ->addFieldToFilter('website_id', $websiteId); $collection->getSelect()->limit($pageSize); return $collection->load(); }
php
public function getMissingContacts($websiteId, $pageSize = 100) { $collection = $this->addFieldToFilter('contact_id', ['null' => true]) ->addFieldToFilter('suppressed', ['null' => true]) ->addFieldToFilter('website_id', $websiteId); $collection->getSelect()->limit($pageSize); return $collection->load(); }
[ "public", "function", "getMissingContacts", "(", "$", "websiteId", ",", "$", "pageSize", "=", "100", ")", "{", "$", "collection", "=", "$", "this", "->", "addFieldToFilter", "(", "'contact_id'", ",", "[", "'null'", "=>", "true", "]", ")", "->", "addFieldTo...
Get missing contacts. @param int $websiteId @param int $pageSize @return $this
[ "Get", "missing", "contacts", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Contact/Collection.php#L106-L115
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Contact/Collection.php
Collection.getNumberSubscribers
public function getNumberSubscribers($websiteId = 0) { return $this->addFieldToFilter( 'subscriber_status', \Dotdigitalgroup\Email\Model\Newsletter\Subscriber::STATUS_SUBSCRIBED ) ->addFieldToFilter('website_id', $websiteId) ->getSize(); }
php
public function getNumberSubscribers($websiteId = 0) { return $this->addFieldToFilter( 'subscriber_status', \Dotdigitalgroup\Email\Model\Newsletter\Subscriber::STATUS_SUBSCRIBED ) ->addFieldToFilter('website_id', $websiteId) ->getSize(); }
[ "public", "function", "getNumberSubscribers", "(", "$", "websiteId", "=", "0", ")", "{", "return", "$", "this", "->", "addFieldToFilter", "(", "'subscriber_status'", ",", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Model", "\\", "Newsletter", "\\", "Subscribe...
Get number of subscribers. @param int $websiteId @return int
[ "Get", "number", "of", "subscribers", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Contact/Collection.php#L286-L294
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Contact/Collection.php
Collection.getSubscriberDataByEmails
public function getSubscriberDataByEmails($emails) { $subscriberFactory = $this->subscriberFactory->create(); $subscribersData = $subscriberFactory->getCollection() ->addFieldToFilter( 'subscriber_email', ['in' => $emails] ) ->addFieldToSelect(['subscriber_email', 'store_id']); return $subscribersData->toArray(); }
php
public function getSubscriberDataByEmails($emails) { $subscriberFactory = $this->subscriberFactory->create(); $subscribersData = $subscriberFactory->getCollection() ->addFieldToFilter( 'subscriber_email', ['in' => $emails] ) ->addFieldToSelect(['subscriber_email', 'store_id']); return $subscribersData->toArray(); }
[ "public", "function", "getSubscriberDataByEmails", "(", "$", "emails", ")", "{", "$", "subscriberFactory", "=", "$", "this", "->", "subscriberFactory", "->", "create", "(", ")", ";", "$", "subscribersData", "=", "$", "subscriberFactory", "->", "getCollection", "...
Get subscribers data by emails @param array $emails @return array
[ "Get", "subscribers", "data", "by", "emails" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Contact/Collection.php#L302-L313
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Contact/Collection.php
Collection.getContactsToImportByWebsite
public function getContactsToImportByWebsite($websiteId, $syncLimit, $onlySubscriber = false) { $collection = $this->addFieldToSelect('*') ->addFieldToFilter('customer_id', ['neq' => '0']) ->addFieldToFilter('email_imported', ['null' => true]) ->addFieldToFilter('website_id', $websiteId) ->setPageSize($syncLimit); if ($onlySubscriber) { $collection->addFieldToFilter('is_subscriber', 1) ->addFieldToFilter( 'subscriber_status', \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED ); } return $collection; }
php
public function getContactsToImportByWebsite($websiteId, $syncLimit, $onlySubscriber = false) { $collection = $this->addFieldToSelect('*') ->addFieldToFilter('customer_id', ['neq' => '0']) ->addFieldToFilter('email_imported', ['null' => true]) ->addFieldToFilter('website_id', $websiteId) ->setPageSize($syncLimit); if ($onlySubscriber) { $collection->addFieldToFilter('is_subscriber', 1) ->addFieldToFilter( 'subscriber_status', \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED ); } return $collection; }
[ "public", "function", "getContactsToImportByWebsite", "(", "$", "websiteId", ",", "$", "syncLimit", ",", "$", "onlySubscriber", "=", "false", ")", "{", "$", "collection", "=", "$", "this", "->", "addFieldToSelect", "(", "'*'", ")", "->", "addFieldToFilter", "(...
Get contacts to import by website @param int $websiteId @param int $syncLimit @param boolean $onlySubscriber @return $this
[ "Get", "contacts", "to", "import", "by", "website" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Contact/Collection.php#L323-L340
train
dotmailer/dotmailer-magento2-extension
Model/Connector/Account.php
Account.setContacts
public function setContacts($contacts) { if (!empty($this->contacts)) { $this->contacts += $contacts; } else { $this->contacts[] = $contacts; } }
php
public function setContacts($contacts) { if (!empty($this->contacts)) { $this->contacts += $contacts; } else { $this->contacts[] = $contacts; } }
[ "public", "function", "setContacts", "(", "$", "contacts", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "contacts", ")", ")", "{", "$", "this", "->", "contacts", "+=", "$", "contacts", ";", "}", "else", "{", "$", "this", "->", "contac...
Set contacts. @param array $contacts @return null
[ "Set", "contacts", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Account.php#L164-L171
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/ContactData.php
ContactData.getFirstCategoryPur
public function getFirstCategoryPur() { $firstOrderId = $this->model->getFirstOrderId(); $order = $this->orderFactory->create(); $this->orderResource->load($order, $firstOrderId); $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems()); return $this->getCategoryNames($categoryIds); }
php
public function getFirstCategoryPur() { $firstOrderId = $this->model->getFirstOrderId(); $order = $this->orderFactory->create(); $this->orderResource->load($order, $firstOrderId); $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems()); return $this->getCategoryNames($categoryIds); }
[ "public", "function", "getFirstCategoryPur", "(", ")", "{", "$", "firstOrderId", "=", "$", "this", "->", "model", "->", "getFirstOrderId", "(", ")", ";", "$", "order", "=", "$", "this", "->", "orderFactory", "->", "create", "(", ")", ";", "$", "this", ...
Get first purchased category. @return string
[ "Get", "first", "purchased", "category", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/ContactData.php#L254-L262
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/ContactData.php
ContactData.getLastCategoryPur
public function getLastCategoryPur() { $lastOrderId = $this->model->getLastOrderId(); $order = $this->orderFactory->create(); $this->orderResource->load($order, $lastOrderId); $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems()); return $this->getCategoryNames($categoryIds); }
php
public function getLastCategoryPur() { $lastOrderId = $this->model->getLastOrderId(); $order = $this->orderFactory->create(); $this->orderResource->load($order, $lastOrderId); $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems()); return $this->getCategoryNames($categoryIds); }
[ "public", "function", "getLastCategoryPur", "(", ")", "{", "$", "lastOrderId", "=", "$", "this", "->", "model", "->", "getLastOrderId", "(", ")", ";", "$", "order", "=", "$", "this", "->", "orderFactory", "->", "create", "(", ")", ";", "$", "this", "->...
Get last purchased category. @return string
[ "Get", "last", "purchased", "category", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/ContactData.php#L291-L299
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/ContactData.php
ContactData.getMostPurCategory
public function getMostPurCategory() { $categories = ''; $productId = $this->model->getProductIdForMostSoldProduct(); //sales data found for customer with product id if ($productId) { $product = $this->getProduct($productId); //product found if ($product->getId()) { $categoryIds = $product->getCategoryIds(); if (count($categoryIds)) { $categories = $this->getCategoryNames($categoryIds); } } } return $categories; }
php
public function getMostPurCategory() { $categories = ''; $productId = $this->model->getProductIdForMostSoldProduct(); //sales data found for customer with product id if ($productId) { $product = $this->getProduct($productId); //product found if ($product->getId()) { $categoryIds = $product->getCategoryIds(); if (count($categoryIds)) { $categories = $this->getCategoryNames($categoryIds); } } } return $categories; }
[ "public", "function", "getMostPurCategory", "(", ")", "{", "$", "categories", "=", "''", ";", "$", "productId", "=", "$", "this", "->", "model", "->", "getProductIdForMostSoldProduct", "(", ")", ";", "//sales data found for customer with product id", "if", "(", "$...
Get most purchased category. @return string
[ "Get", "most", "purchased", "category", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/ContactData.php#L422-L439
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.getMostViewedProductCollection
public function getMostViewedProductCollection($from, $to, $limit, $catId, $catName) { $reportProductCollection = $this->reportProductCollection->create() ->addViewsCount($from, $to) ->setPageSize($limit); //filter collection by category by category_id if ($catId) { $category = $this->categoryFactory->create(); $this->categoryResource->load($category, $catId); if ($category->getId()) { $reportProductCollection->getSelect() ->joinLeft( ['ccpi' => $this->getTable('catalog_category_product_index')], 'e.entity_id = ccpi.product_id', ['category_id'] ) ->where('ccpi.category_id =?', $catId); } else { $this->helper->log( 'Most viewed. Category id ' . $catId . ' is invalid. It does not exist.' ); } } //filter collection by category by category_name if ($catName) { $category = $this->categoryFactory->create() ->loadByAttribute('name', $catName); if ($category->getId()) { $reportProductCollection->getSelect() ->joinLeft( ['ccpi' => $this->getTable('catalog_category_product_index')], 'e.entity_id = ccpi.product_id', ['category_id'] ) ->where('ccpi.category_id =?', $category->getId()); } else { $this->helper->log( 'Most viewed. Category name ' . $catName . ' is invalid. It does not exist.' ); } } return $reportProductCollection; }
php
public function getMostViewedProductCollection($from, $to, $limit, $catId, $catName) { $reportProductCollection = $this->reportProductCollection->create() ->addViewsCount($from, $to) ->setPageSize($limit); //filter collection by category by category_id if ($catId) { $category = $this->categoryFactory->create(); $this->categoryResource->load($category, $catId); if ($category->getId()) { $reportProductCollection->getSelect() ->joinLeft( ['ccpi' => $this->getTable('catalog_category_product_index')], 'e.entity_id = ccpi.product_id', ['category_id'] ) ->where('ccpi.category_id =?', $catId); } else { $this->helper->log( 'Most viewed. Category id ' . $catId . ' is invalid. It does not exist.' ); } } //filter collection by category by category_name if ($catName) { $category = $this->categoryFactory->create() ->loadByAttribute('name', $catName); if ($category->getId()) { $reportProductCollection->getSelect() ->joinLeft( ['ccpi' => $this->getTable('catalog_category_product_index')], 'e.entity_id = ccpi.product_id', ['category_id'] ) ->where('ccpi.category_id =?', $category->getId()); } else { $this->helper->log( 'Most viewed. Category name ' . $catName . ' is invalid. It does not exist.' ); } } return $reportProductCollection; }
[ "public", "function", "getMostViewedProductCollection", "(", "$", "from", ",", "$", "to", ",", "$", "limit", ",", "$", "catId", ",", "$", "catName", ")", "{", "$", "reportProductCollection", "=", "$", "this", "->", "reportProductCollection", "->", "create", ...
Get most viewed product collection. @param string $from @param string $to @param int $limit @param int $catId @param string $catName @return \Magento\Reports\Model\ResourceModel\Product\Collection
[ "Get", "most", "viewed", "product", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L126-L173
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.getRecentlyViewed
public function getRecentlyViewed($customerId, $limit) { $attributes = $this->config->getProductAttributes(); $this->productIndexcollection->addAttributeToSelect($attributes); $this->productIndexcollection->setCustomerId($customerId); $this->productIndexcollection->addUrlRewrite()->setPageSize( $limit )->setCurPage( 1 ); /* Price data is added to consider item stock status using price index */ $collection = $this->productIndexcollection->addPriceData() ->addIndexFilter() ->setAddedAtOrder() ->setVisibility($this->productVisibility->getVisibleInSiteIds()); return $collection->getColumnValues('product_id'); }
php
public function getRecentlyViewed($customerId, $limit) { $attributes = $this->config->getProductAttributes(); $this->productIndexcollection->addAttributeToSelect($attributes); $this->productIndexcollection->setCustomerId($customerId); $this->productIndexcollection->addUrlRewrite()->setPageSize( $limit )->setCurPage( 1 ); /* Price data is added to consider item stock status using price index */ $collection = $this->productIndexcollection->addPriceData() ->addIndexFilter() ->setAddedAtOrder() ->setVisibility($this->productVisibility->getVisibleInSiteIds()); return $collection->getColumnValues('product_id'); }
[ "public", "function", "getRecentlyViewed", "(", "$", "customerId", ",", "$", "limit", ")", "{", "$", "attributes", "=", "$", "this", "->", "config", "->", "getProductAttributes", "(", ")", ";", "$", "this", "->", "productIndexcollection", "->", "addAttributeTo...
Get recently viewed. @param int $customerId @param int $limit @return array
[ "Get", "recently", "viewed", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L183-L202
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.getProductCollectionFromIds
public function getProductCollectionFromIds($ids, $limit = false) { $productCollection = []; if (! empty($ids)) { $productCollection = $this->productFactory->create() ->getCollection() ->addIdFilter($ids) ->addAttributeToSelect( ['product_url', 'name', 'store_id', 'small_image', 'price'] ); if ($limit) { $productCollection->getSelect()->limit($limit); } } return $productCollection; }
php
public function getProductCollectionFromIds($ids, $limit = false) { $productCollection = []; if (! empty($ids)) { $productCollection = $this->productFactory->create() ->getCollection() ->addIdFilter($ids) ->addAttributeToSelect( ['product_url', 'name', 'store_id', 'small_image', 'price'] ); if ($limit) { $productCollection->getSelect()->limit($limit); } } return $productCollection; }
[ "public", "function", "getProductCollectionFromIds", "(", "$", "ids", ",", "$", "limit", "=", "false", ")", "{", "$", "productCollection", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "ids", ")", ")", "{", "$", "productCollection", "=", "$", ...
Get product collection from ids. @param array $ids @param int|bool $limit @return array|\Magento\Catalog\Model\ResourceModel\Product\Collection
[ "Get", "product", "collection", "from", "ids", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L212-L230
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.getProductsCollectionBySku
public function getProductsCollectionBySku($productsSku, $limit = false) { $productCollection = []; if (! empty($productsSku)) { $productCollection = $this->productFactory->create() ->getCollection() ->addAttributeToSelect( ['product_url', 'name', 'store_id', 'small_image', 'price', 'visibility'] )->addFieldToFilter('sku', ['in' => $productsSku]); if ($limit) { $productCollection->getSelect()->limit($limit); } } return $productCollection; }
php
public function getProductsCollectionBySku($productsSku, $limit = false) { $productCollection = []; if (! empty($productsSku)) { $productCollection = $this->productFactory->create() ->getCollection() ->addAttributeToSelect( ['product_url', 'name', 'store_id', 'small_image', 'price', 'visibility'] )->addFieldToFilter('sku', ['in' => $productsSku]); if ($limit) { $productCollection->getSelect()->limit($limit); } } return $productCollection; }
[ "public", "function", "getProductsCollectionBySku", "(", "$", "productsSku", ",", "$", "limit", "=", "false", ")", "{", "$", "productCollection", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "productsSku", ")", ")", "{", "$", "productCollection",...
Get product collection from sku. @param array $productsSku @param int|bool $limit @return array|\Magento\Catalog\Model\ResourceModel\Product\Collection
[ "Get", "product", "collection", "from", "sku", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L240-L257
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.getBestsellerCollection
public function getBestsellerCollection($from, $to, $limit, $storeId) { //create report collection $reportProductCollection = $this->productSoldFactory->create() ->addOrderedQty($from, $to) ->setOrder('ordered_qty', 'desc') ->setStoreIds([$storeId]) ->setPageSize($limit); $productsSku = $reportProductCollection->getColumnValues('order_items_sku'); return $this->getProductsCollectionBySku($productsSku); }
php
public function getBestsellerCollection($from, $to, $limit, $storeId) { //create report collection $reportProductCollection = $this->productSoldFactory->create() ->addOrderedQty($from, $to) ->setOrder('ordered_qty', 'desc') ->setStoreIds([$storeId]) ->setPageSize($limit); $productsSku = $reportProductCollection->getColumnValues('order_items_sku'); return $this->getProductsCollectionBySku($productsSku); }
[ "public", "function", "getBestsellerCollection", "(", "$", "from", ",", "$", "to", ",", "$", "limit", ",", "$", "storeId", ")", "{", "//create report collection", "$", "reportProductCollection", "=", "$", "this", "->", "productSoldFactory", "->", "create", "(", ...
Get bestseller collection. @param string $from @param string $to @param int $limit @param int $storeId @return array|\Magento\Catalog\Model\ResourceModel\Product\Collection
[ "Get", "bestseller", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L269-L281
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.resetCatalog
public function resetCatalog($from = null, $to = null) { $conn = $this->getConnection(); if ($from && $to) { $where = [ 'created_at >= ?' => $from . ' 00:00:00', 'created_at <= ?' => $to . ' 23:59:59', 'imported is ?' => new \Zend_Db_Expr('not null') ]; } else { $where = $conn->quoteInto( 'imported is ?', new \Zend_Db_Expr('not null') ); } $num = $conn->update( $this->getTable(Schema::EMAIL_CATALOG_TABLE), [ 'imported' => new \Zend_Db_Expr('null'), 'modified' => new \Zend_Db_Expr('null'), ], $where ); return $num; }
php
public function resetCatalog($from = null, $to = null) { $conn = $this->getConnection(); if ($from && $to) { $where = [ 'created_at >= ?' => $from . ' 00:00:00', 'created_at <= ?' => $to . ' 23:59:59', 'imported is ?' => new \Zend_Db_Expr('not null') ]; } else { $where = $conn->quoteInto( 'imported is ?', new \Zend_Db_Expr('not null') ); } $num = $conn->update( $this->getTable(Schema::EMAIL_CATALOG_TABLE), [ 'imported' => new \Zend_Db_Expr('null'), 'modified' => new \Zend_Db_Expr('null'), ], $where ); return $num; }
[ "public", "function", "resetCatalog", "(", "$", "from", "=", "null", ",", "$", "to", "=", "null", ")", "{", "$", "conn", "=", "$", "this", "->", "getConnection", "(", ")", ";", "if", "(", "$", "from", "&&", "$", "to", ")", "{", "$", "where", "=...
Reset for re-import. @param string|null $from @param string|null $to @return int
[ "Reset", "for", "re", "-", "import", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L292-L317
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.setImportedByIds
public function setImportedByIds($ids) { try { $coreResource = $this->getConnection(); $tableName = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $coreResource->update( $tableName, [ 'modified' => new \Zend_Db_Expr('null'), 'imported' => '1', 'updated_at' => gmdate('Y-m-d H:i:s'), ], ["product_id IN (?)" => $ids] ); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } }
php
public function setImportedByIds($ids) { try { $coreResource = $this->getConnection(); $tableName = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $coreResource->update( $tableName, [ 'modified' => new \Zend_Db_Expr('null'), 'imported' => '1', 'updated_at' => gmdate('Y-m-d H:i:s'), ], ["product_id IN (?)" => $ids] ); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } }
[ "public", "function", "setImportedByIds", "(", "$", "ids", ")", "{", "try", "{", "$", "coreResource", "=", "$", "this", "->", "getConnection", "(", ")", ";", "$", "tableName", "=", "$", "this", "->", "getTable", "(", "Schema", "::", "EMAIL_CATALOG_TABLE", ...
Set imported and modified in bulk query. @param array $ids @return null
[ "Set", "imported", "and", "modified", "in", "bulk", "query", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L326-L344
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.removeOrphanProducts
public function removeOrphanProducts() { $write = $this->getConnection(); $catalogTable = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $select = $write->select(); $select->reset() ->from( ['c' => $catalogTable], ['c.product_id'] ) ->joinLeft( [ 'e' => $this->getTable( 'catalog_product_entity' ), ], 'c.product_id = e.entity_id' ) ->where('e.entity_id is NULL'); //delete sql statement $deleteSql = $select->deleteFromSelect('c'); //run query $write->query($deleteSql); }
php
public function removeOrphanProducts() { $write = $this->getConnection(); $catalogTable = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $select = $write->select(); $select->reset() ->from( ['c' => $catalogTable], ['c.product_id'] ) ->joinLeft( [ 'e' => $this->getTable( 'catalog_product_entity' ), ], 'c.product_id = e.entity_id' ) ->where('e.entity_id is NULL'); //delete sql statement $deleteSql = $select->deleteFromSelect('c'); //run query $write->query($deleteSql); }
[ "public", "function", "removeOrphanProducts", "(", ")", "{", "$", "write", "=", "$", "this", "->", "getConnection", "(", ")", ";", "$", "catalogTable", "=", "$", "this", "->", "getTable", "(", "Schema", "::", "EMAIL_CATALOG_TABLE", ")", ";", "$", "select",...
Remove product with product id set and no product @return null
[ "Remove", "product", "with", "product", "id", "set", "and", "no", "product" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L351-L376
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog.php
Catalog.setModified
public function setModified($ids) { $write = $this->getConnection(); $tableName = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $write->update( $tableName, ['modified' => 1], [ $write->quoteInto("product_id IN (?)", $ids), $write->quoteInto("imported = ?", 1) ] ); }
php
public function setModified($ids) { $write = $this->getConnection(); $tableName = $this->getTable(Schema::EMAIL_CATALOG_TABLE); $write->update( $tableName, ['modified' => 1], [ $write->quoteInto("product_id IN (?)", $ids), $write->quoteInto("imported = ?", 1) ] ); }
[ "public", "function", "setModified", "(", "$", "ids", ")", "{", "$", "write", "=", "$", "this", "->", "getConnection", "(", ")", ";", "$", "tableName", "=", "$", "this", "->", "getTable", "(", "Schema", "::", "EMAIL_CATALOG_TABLE", ")", ";", "$", "writ...
Set modified if already imported @param array $ids
[ "Set", "modified", "if", "already", "imported" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog.php#L383-L395
train
dotmailer/dotmailer-magento2-extension
Console/Command/Provider/SyncProvider.php
SyncProvider.getAvailableSyncs
public function getAvailableSyncs($concreteName = true) { return array_map(function ($class) use ($concreteName) { $classBasename = substr(get_class($class), strrpos(get_class($class), '\\') + 1); return $concreteName ? str_replace('Factory', '', $classBasename) : $classBasename; }, get_object_vars($this)); }
php
public function getAvailableSyncs($concreteName = true) { return array_map(function ($class) use ($concreteName) { $classBasename = substr(get_class($class), strrpos(get_class($class), '\\') + 1); return $concreteName ? str_replace('Factory', '', $classBasename) : $classBasename; }, get_object_vars($this)); }
[ "public", "function", "getAvailableSyncs", "(", "$", "concreteName", "=", "true", ")", "{", "return", "array_map", "(", "function", "(", "$", "class", ")", "use", "(", "$", "concreteName", ")", "{", "$", "classBasename", "=", "substr", "(", "get_class", "(...
Get names of available sync objects @param bool $concreteName Get the concrete class name (not it's factory) @return array
[ "Get", "names", "of", "available", "sync", "objects" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Console/Command/Provider/SyncProvider.php#L95-L101
train
dotmailer/dotmailer-magento2-extension
Model/Config/Configuration/Addressbooks.php
Addressbooks.getAddressBooks
public function getAddressBooks() { $website = $this->helper->getWebsite(); $client = $this->helper->getWebsiteApiClient($website); $savedAddressBooks = $this->registry->registry('addressbooks'); //get saved address books from registry if ($savedAddressBooks) { $addressBooks = $savedAddressBooks; } else { // api all address books $addressBooks = $client->getAddressBooks(); $this->registry->unregister('addressbooks'); // additional measure $this->registry->register('addressbooks', $addressBooks); } return $addressBooks; }
php
public function getAddressBooks() { $website = $this->helper->getWebsite(); $client = $this->helper->getWebsiteApiClient($website); $savedAddressBooks = $this->registry->registry('addressbooks'); //get saved address books from registry if ($savedAddressBooks) { $addressBooks = $savedAddressBooks; } else { // api all address books $addressBooks = $client->getAddressBooks(); $this->registry->unregister('addressbooks'); // additional measure $this->registry->register('addressbooks', $addressBooks); } return $addressBooks; }
[ "public", "function", "getAddressBooks", "(", ")", "{", "$", "website", "=", "$", "this", "->", "helper", "->", "getWebsite", "(", ")", ";", "$", "client", "=", "$", "this", "->", "helper", "->", "getWebsiteApiClient", "(", "$", "website", ")", ";", "$...
Get address books. @return null
[ "Get", "address", "books", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Configuration/Addressbooks.php#L44-L61
train
dotmailer/dotmailer-magento2-extension
Model/Config/Source/Transactional/Email/Template.php
Template.toOptionArray
public function toOptionArray() { /** @var $collection \Magento\Email\Model\ResourceModel\Template\Collection */ if (!($collection = $this->coreRegistry->registry('config_system_email_template'))) { $collection = $this->templatesFactory->create(); $collection->load(); $this->coreRegistry->register('config_system_email_template', $collection); } return $this->emailConfig->getAvailableTemplates(); }
php
public function toOptionArray() { /** @var $collection \Magento\Email\Model\ResourceModel\Template\Collection */ if (!($collection = $this->coreRegistry->registry('config_system_email_template'))) { $collection = $this->templatesFactory->create(); $collection->load(); $this->coreRegistry->register('config_system_email_template', $collection); } return $this->emailConfig->getAvailableTemplates(); }
[ "public", "function", "toOptionArray", "(", ")", "{", "/** @var $collection \\Magento\\Email\\Model\\ResourceModel\\Template\\Collection */", "if", "(", "!", "(", "$", "collection", "=", "$", "this", "->", "coreRegistry", "->", "registry", "(", "'config_system_email_templat...
Generate list of email templates @return array
[ "Generate", "list", "of", "email", "templates" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Source/Transactional/Email/Template.php#L45-L54
train
dotmailer/dotmailer-magento2-extension
Setup/UpgradeData.php
UpgradeData.encryptAllRefreshTokens
private function encryptAllRefreshTokens() { $userCollection = $this->userCollectionFactory->create() ->addFieldToFilter('refresh_token', ['notnull' => true]); foreach ($userCollection as $user) { $this->encryptAndSaveRefreshToken($user); } }
php
private function encryptAllRefreshTokens() { $userCollection = $this->userCollectionFactory->create() ->addFieldToFilter('refresh_token', ['notnull' => true]); foreach ($userCollection as $user) { $this->encryptAndSaveRefreshToken($user); } }
[ "private", "function", "encryptAllRefreshTokens", "(", ")", "{", "$", "userCollection", "=", "$", "this", "->", "userCollectionFactory", "->", "create", "(", ")", "->", "addFieldToFilter", "(", "'refresh_token'", ",", "[", "'notnull'", "=>", "true", "]", ")", ...
Encrypt all tokens
[ "Encrypt", "all", "tokens" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/UpgradeData.php#L130-L138
train
dotmailer/dotmailer-magento2-extension
Setup/UpgradeData.php
UpgradeData.encryptAndSaveRefreshToken
private function encryptAndSaveRefreshToken($user) { $user->setRefreshToken( $this->helper->encryptor->encrypt($user->getRefreshToken()) ); $this->userResource->save($user); }
php
private function encryptAndSaveRefreshToken($user) { $user->setRefreshToken( $this->helper->encryptor->encrypt($user->getRefreshToken()) ); $this->userResource->save($user); }
[ "private", "function", "encryptAndSaveRefreshToken", "(", "$", "user", ")", "{", "$", "user", "->", "setRefreshToken", "(", "$", "this", "->", "helper", "->", "encryptor", "->", "encrypt", "(", "$", "user", "->", "getRefreshToken", "(", ")", ")", ")", ";",...
Encrypt token and save @param \Magento\User\Model\User $user
[ "Encrypt", "token", "and", "save" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/UpgradeData.php#L145-L151
train
dotmailer/dotmailer-magento2-extension
Setup/UpgradeData.php
UpgradeData.encryptAllPasswords
private function encryptAllPasswords() { $websites = $this->helper->getWebsites(true); $paths = [ Config::XML_PATH_CONNECTOR_API_PASSWORD, Transactional::XML_PATH_DDG_TRANSACTIONAL_PASSWORD ]; foreach ($websites as $website) { if ($website->getId() > 0) { $scope = ScopeInterface::SCOPE_WEBSITES; } else { $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT; } foreach ($paths as $path) { $this->encryptAndSavePassword( $path, $scope, $website->getId() ); } } }
php
private function encryptAllPasswords() { $websites = $this->helper->getWebsites(true); $paths = [ Config::XML_PATH_CONNECTOR_API_PASSWORD, Transactional::XML_PATH_DDG_TRANSACTIONAL_PASSWORD ]; foreach ($websites as $website) { if ($website->getId() > 0) { $scope = ScopeInterface::SCOPE_WEBSITES; } else { $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT; } foreach ($paths as $path) { $this->encryptAndSavePassword( $path, $scope, $website->getId() ); } } }
[ "private", "function", "encryptAllPasswords", "(", ")", "{", "$", "websites", "=", "$", "this", "->", "helper", "->", "getWebsites", "(", "true", ")", ";", "$", "paths", "=", "[", "Config", "::", "XML_PATH_CONNECTOR_API_PASSWORD", ",", "Transactional", "::", ...
Encrypt passwords and save for all websites
[ "Encrypt", "passwords", "and", "save", "for", "all", "websites" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/UpgradeData.php#L156-L178
train
dotmailer/dotmailer-magento2-extension
Setup/UpgradeData.php
UpgradeData.encryptAndSavePassword
private function encryptAndSavePassword($path, $scope, $id) { $configCollection = $this->configCollectionFactory->create() ->addFieldToFilter('scope', $scope) ->addFieldToFilter('scope_id', $id) ->addFieldToFilter('path', $path) ->setPageSize(1); if ($configCollection->getSize()) { $value = $configCollection->getFirstItem()->getValue(); if ($value) { $this->helper->saveConfigData( $path, $this->helper->encryptor->encrypt($value), $scope, $id ); } } }
php
private function encryptAndSavePassword($path, $scope, $id) { $configCollection = $this->configCollectionFactory->create() ->addFieldToFilter('scope', $scope) ->addFieldToFilter('scope_id', $id) ->addFieldToFilter('path', $path) ->setPageSize(1); if ($configCollection->getSize()) { $value = $configCollection->getFirstItem()->getValue(); if ($value) { $this->helper->saveConfigData( $path, $this->helper->encryptor->encrypt($value), $scope, $id ); } } }
[ "private", "function", "encryptAndSavePassword", "(", "$", "path", ",", "$", "scope", ",", "$", "id", ")", "{", "$", "configCollection", "=", "$", "this", "->", "configCollectionFactory", "->", "create", "(", ")", "->", "addFieldToFilter", "(", "'scope'", ",...
Encrypt already saved passwords @param string $path @param string $scope @param int $id
[ "Encrypt", "already", "saved", "passwords" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/UpgradeData.php#L187-L206
train
dotmailer/dotmailer-magento2-extension
Model/Email/Template.php
Template.deleteTemplateByCode
public function deleteTemplateByCode($templatecode) { $template = $this->loadByTemplateByCode($templatecode); if ($template->getId()) { $template->delete(); } }
php
public function deleteTemplateByCode($templatecode) { $template = $this->loadByTemplateByCode($templatecode); if ($template->getId()) { $template->delete(); } }
[ "public", "function", "deleteTemplateByCode", "(", "$", "templatecode", ")", "{", "$", "template", "=", "$", "this", "->", "loadByTemplateByCode", "(", "$", "templatecode", ")", ";", "if", "(", "$", "template", "->", "getId", "(", ")", ")", "{", "$", "te...
Delete email_template. @param string $templatecode
[ "Delete", "email_template", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Email/Template.php#L263-L269
train
dotmailer/dotmailer-magento2-extension
Model/Email/Template.php
Template.sync
public function sync() { $result = ['store' => 'Stores : ', 'message' => 'Done.']; $lastWebsiteId = '0'; foreach ($this->storeManager->getStores(true) as $store) { $storeId = $store->getId(); //store not enabled to sync if (! $this->helper->isStoreEnabled($storeId)) { continue; } //reset the campaign ids for each website $websiteId = $store->getWebsiteId(); if ($websiteId != $lastWebsiteId) { $this->processedCampaigns = []; $lastWebsiteId = $websiteId; } foreach ($this->templateConfigIdToDotmailerConfigPath as $configTemplateId => $dotConfigPath) { $campaignId = $this->getConfigValue($dotConfigPath, $storeId); $configPath = $this->templateConfigMapping[$configTemplateId]; $emailTemplateId = $this->getConfigValue($configPath, $storeId); if ($campaignId && $emailTemplateId && ! in_array($campaignId, $this->processedCampaigns)) { //sync template for store $this->syncEmailTemplate($campaignId, $emailTemplateId, $store); $result['store'] .= ', ' . $store->getCode(); $this->processedCampaigns[$campaignId] = $campaignId; } } } return $result; }
php
public function sync() { $result = ['store' => 'Stores : ', 'message' => 'Done.']; $lastWebsiteId = '0'; foreach ($this->storeManager->getStores(true) as $store) { $storeId = $store->getId(); //store not enabled to sync if (! $this->helper->isStoreEnabled($storeId)) { continue; } //reset the campaign ids for each website $websiteId = $store->getWebsiteId(); if ($websiteId != $lastWebsiteId) { $this->processedCampaigns = []; $lastWebsiteId = $websiteId; } foreach ($this->templateConfigIdToDotmailerConfigPath as $configTemplateId => $dotConfigPath) { $campaignId = $this->getConfigValue($dotConfigPath, $storeId); $configPath = $this->templateConfigMapping[$configTemplateId]; $emailTemplateId = $this->getConfigValue($configPath, $storeId); if ($campaignId && $emailTemplateId && ! in_array($campaignId, $this->processedCampaigns)) { //sync template for store $this->syncEmailTemplate($campaignId, $emailTemplateId, $store); $result['store'] .= ', ' . $store->getCode(); $this->processedCampaigns[$campaignId] = $campaignId; } } } return $result; }
[ "public", "function", "sync", "(", ")", "{", "$", "result", "=", "[", "'store'", "=>", "'Stores : '", ",", "'message'", "=>", "'Done.'", "]", ";", "$", "lastWebsiteId", "=", "'0'", ";", "foreach", "(", "$", "this", "->", "storeManager", "->", "getStores"...
Template sync. @return array
[ "Template", "sync", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Email/Template.php#L276-L309
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Contact.php
Contact.sync
public function sync() { //result message $result = ['success' => true, 'message' => '']; //starting time for sync $this->start = microtime(true); //export bulk contacts foreach ($this->helper->getWebsites() as $website) { $apiEnabled = $this->helper->isEnabled($website); $customerSyncEnabled = $this->helper->isCustomerSyncEnabled( $website ); $customerAddressBook = $this->helper->getCustomerAddressBook( $website ); //api, customer sync and customer address book must be enabled if ($apiEnabled && $customerSyncEnabled && $customerAddressBook) { //start log $contactsUpdated = $this->exportCustomersForWebsite($website); // show message for any number of customers if ($contactsUpdated) { $result['message'] .= $website->getName() . ', updated contacts ' . $contactsUpdated; } } } //sync proccessed if ($this->countCustomers) { $message = '----------- Customer sync ----------- : ' . gmdate('H:i:s', microtime(true) - $this->start) . ', Total contacts = ' . $this->countCustomers; $this->helper->log($message); $message .= $result['message']; $result['message'] = $message; } return $result; }
php
public function sync() { //result message $result = ['success' => true, 'message' => '']; //starting time for sync $this->start = microtime(true); //export bulk contacts foreach ($this->helper->getWebsites() as $website) { $apiEnabled = $this->helper->isEnabled($website); $customerSyncEnabled = $this->helper->isCustomerSyncEnabled( $website ); $customerAddressBook = $this->helper->getCustomerAddressBook( $website ); //api, customer sync and customer address book must be enabled if ($apiEnabled && $customerSyncEnabled && $customerAddressBook) { //start log $contactsUpdated = $this->exportCustomersForWebsite($website); // show message for any number of customers if ($contactsUpdated) { $result['message'] .= $website->getName() . ', updated contacts ' . $contactsUpdated; } } } //sync proccessed if ($this->countCustomers) { $message = '----------- Customer sync ----------- : ' . gmdate('H:i:s', microtime(true) - $this->start) . ', Total contacts = ' . $this->countCustomers; $this->helper->log($message); $message .= $result['message']; $result['message'] = $message; } return $result; }
[ "public", "function", "sync", "(", ")", "{", "//result message", "$", "result", "=", "[", "'success'", "=>", "true", ",", "'message'", "=>", "''", "]", ";", "//starting time for sync", "$", "this", "->", "start", "=", "microtime", "(", "true", ")", ";", ...
Contact sync. @return array
[ "Contact", "sync", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Contact.php#L82-L121
train
dotmailer/dotmailer-magento2-extension
Controller/Ajax/Emailcapture.php
Emailcapture.execute
public function execute() { $email = $this->getRequest()->getParam('email'); if ($email && $quote = $this->checkoutSession->getQuote()) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return null; } if ($quote->hasItems()) { try { $quote->setCustomerEmail($email); $this->quoteResource->save($quote); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } } } }
php
public function execute() { $email = $this->getRequest()->getParam('email'); if ($email && $quote = $this->checkoutSession->getQuote()) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return null; } if ($quote->hasItems()) { try { $quote->setCustomerEmail($email); $this->quoteResource->save($quote); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } } } }
[ "public", "function", "execute", "(", ")", "{", "$", "email", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParam", "(", "'email'", ")", ";", "if", "(", "$", "email", "&&", "$", "quote", "=", "$", "this", "->", "checkoutSession", "->", ...
Easy email capture for Newsletter and Checkout. @return null
[ "Easy", "email", "capture", "for", "Newsletter", "and", "Checkout", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Ajax/Emailcapture.php#L46-L64
train
dotmailer/dotmailer-magento2-extension
Model/Config/Source/Settings/Addressbooks.php
Addressbooks.toOptionArray
public function toOptionArray() { $fields = []; // Add a "Do Not Map" Option $fields[] = ['value' => 0, 'label' => '-- Please Select --']; $apiEnabled = $this->helper->isEnabled($this->helper->getWebsite()); if ($apiEnabled) { $savedAddressbooks = $this->registry->registry('addressbooks'); if ($savedAddressbooks) { $addressBooks = $savedAddressbooks; } else { $client = $this->helper->getWebsiteApiClient($this->helper->getWebsite()); //make an api call an register the addressbooks $addressBooks = $client->getAddressBooks(); if ($addressBooks) { $this->registry->unregister('addressbooks'); // additional measure $this->registry->register('addressbooks', $addressBooks); } } //set up fields with book id and label foreach ($addressBooks as $book) { if (isset($book->id)) { $fields[] = [ 'value' => (string)$book->id, 'label' => (string)$book->name, ]; } } } return $fields; }
php
public function toOptionArray() { $fields = []; // Add a "Do Not Map" Option $fields[] = ['value' => 0, 'label' => '-- Please Select --']; $apiEnabled = $this->helper->isEnabled($this->helper->getWebsite()); if ($apiEnabled) { $savedAddressbooks = $this->registry->registry('addressbooks'); if ($savedAddressbooks) { $addressBooks = $savedAddressbooks; } else { $client = $this->helper->getWebsiteApiClient($this->helper->getWebsite()); //make an api call an register the addressbooks $addressBooks = $client->getAddressBooks(); if ($addressBooks) { $this->registry->unregister('addressbooks'); // additional measure $this->registry->register('addressbooks', $addressBooks); } } //set up fields with book id and label foreach ($addressBooks as $book) { if (isset($book->id)) { $fields[] = [ 'value' => (string)$book->id, 'label' => (string)$book->name, ]; } } } return $fields; }
[ "public", "function", "toOptionArray", "(", ")", "{", "$", "fields", "=", "[", "]", ";", "// Add a \"Do Not Map\" Option", "$", "fields", "[", "]", "=", "[", "'value'", "=>", "0", ",", "'label'", "=>", "'-- Please Select --'", "]", ";", "$", "apiEnabled", ...
Retrieve list of options. @return array
[ "Retrieve", "list", "of", "options", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Source/Settings/Addressbooks.php#L36-L70
train
dotmailer/dotmailer-magento2-extension
Model/Config/Source/Carts/Interval.php
Interval.toOptionArray
public function toOptionArray() { $result = $row = []; $i = 0; foreach ($this->times as $one) { if ($i == 0) { $row = [ 'value' => $one, 'label' => $one . __(' Hour'), ]; } else { $row = [ 'value' => $one, 'label' => $one . __(' Hours'), ]; } $result[] = $row; ++$i; } return $result; }
php
public function toOptionArray() { $result = $row = []; $i = 0; foreach ($this->times as $one) { if ($i == 0) { $row = [ 'value' => $one, 'label' => $one . __(' Hour'), ]; } else { $row = [ 'value' => $one, 'label' => $one . __(' Hours'), ]; } $result[] = $row; ++$i; } return $result; }
[ "public", "function", "toOptionArray", "(", ")", "{", "$", "result", "=", "$", "row", "=", "[", "]", ";", "$", "i", "=", "0", ";", "foreach", "(", "$", "this", "->", "times", "as", "$", "one", ")", "{", "if", "(", "$", "i", "==", "0", ")", ...
Send to campain options hours. @return array
[ "Send", "to", "campain", "options", "hours", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Source/Carts/Interval.php#L38-L59
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.checkStatusForPendingContacts
private function checkStatusForPendingContacts() { $updatedAt = $this->dateTime->formatDate(true); if ($this->isItTimeToCheckPendingContact()) { $collection = $this->automationFactory->create() ->getCollectionByPendingStatus(); $idsToUpdateStatus = []; $idsToUpdateDate = []; foreach ($collection as $item) { $contact = $this->helper->getContact($item->getEmail(), $item->getWebsiteId()); if (isset($contact->id) && $contact->status !== self::CONTACT_STATUS_PENDING) { //add to array for update status $idsToUpdateStatus[] = $item->getId(); } else { //add to array for update date $idsToUpdateDate[] = $item->getId(); } } if (! empty($idsToUpdateStatus)) { $this->automationResource ->update( $idsToUpdateStatus, $updatedAt, self::CONTACT_STATUS_CONFIRMED ); } if (! empty($idsToUpdateDate)) { $this->automationResource ->update( $idsToUpdateDate, $updatedAt ); } } //Get pending with 24 house delay and expire it $collection = $this->automationFactory->create() ->getCollectionByPendingStatus($this->getDateTimeForExpiration()); $ids = $collection->getColumnValues('id'); if (! empty($ids)) { $this->automationResource ->update( $ids, $updatedAt, self::CONTACT_STATUS_EXPIRED ); } }
php
private function checkStatusForPendingContacts() { $updatedAt = $this->dateTime->formatDate(true); if ($this->isItTimeToCheckPendingContact()) { $collection = $this->automationFactory->create() ->getCollectionByPendingStatus(); $idsToUpdateStatus = []; $idsToUpdateDate = []; foreach ($collection as $item) { $contact = $this->helper->getContact($item->getEmail(), $item->getWebsiteId()); if (isset($contact->id) && $contact->status !== self::CONTACT_STATUS_PENDING) { //add to array for update status $idsToUpdateStatus[] = $item->getId(); } else { //add to array for update date $idsToUpdateDate[] = $item->getId(); } } if (! empty($idsToUpdateStatus)) { $this->automationResource ->update( $idsToUpdateStatus, $updatedAt, self::CONTACT_STATUS_CONFIRMED ); } if (! empty($idsToUpdateDate)) { $this->automationResource ->update( $idsToUpdateDate, $updatedAt ); } } //Get pending with 24 house delay and expire it $collection = $this->automationFactory->create() ->getCollectionByPendingStatus($this->getDateTimeForExpiration()); $ids = $collection->getColumnValues('id'); if (! empty($ids)) { $this->automationResource ->update( $ids, $updatedAt, self::CONTACT_STATUS_EXPIRED ); } }
[ "private", "function", "checkStatusForPendingContacts", "(", ")", "{", "$", "updatedAt", "=", "$", "this", "->", "dateTime", "->", "formatDate", "(", "true", ")", ";", "if", "(", "$", "this", "->", "isItTimeToCheckPendingContact", "(", ")", ")", "{", "$", ...
check automation entries for pending contacts
[ "check", "automation", "entries", "for", "pending", "contacts" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L219-L270
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.updateDatafieldsByType
private function updateDatafieldsByType($type, $email, $websiteId) { switch ($type) { case self::AUTOMATION_TYPE_NEW_ORDER: case self::AUTOMATION_TYPE_NEW_GUEST_ORDER: case self::ORDER_STATUS_AUTOMATION: case self::AUTOMATION_TYPE_CUSTOMER_FIRST_ORDER: $this->updateNewOrderDatafields($websiteId); break; case self::AUTOMATION_TYPE_ABANDONED_CART_PROGRAM_ENROLMENT: $this->updateAbandoned->updateAbandonedCartDatafields($email, $websiteId, $this->typeId, $this->storeName); default: $this->updateDefaultDatafields($email, $websiteId); break; } }
php
private function updateDatafieldsByType($type, $email, $websiteId) { switch ($type) { case self::AUTOMATION_TYPE_NEW_ORDER: case self::AUTOMATION_TYPE_NEW_GUEST_ORDER: case self::ORDER_STATUS_AUTOMATION: case self::AUTOMATION_TYPE_CUSTOMER_FIRST_ORDER: $this->updateNewOrderDatafields($websiteId); break; case self::AUTOMATION_TYPE_ABANDONED_CART_PROGRAM_ENROLMENT: $this->updateAbandoned->updateAbandonedCartDatafields($email, $websiteId, $this->typeId, $this->storeName); default: $this->updateDefaultDatafields($email, $websiteId); break; } }
[ "private", "function", "updateDatafieldsByType", "(", "$", "type", ",", "$", "email", ",", "$", "websiteId", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "self", "::", "AUTOMATION_TYPE_NEW_ORDER", ":", "case", "self", "::", "AUTOMATION_TYPE_NEW_GUES...
Update single contact datafields for this automation type. @param string $type @param string $email @param int $websiteId @return null @throws \Magento\Framework\Exception\LocalizedException
[ "Update", "single", "contact", "datafields", "for", "this", "automation", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L315-L330
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.updateDefaultDatafields
private function updateDefaultDatafields($email, $websiteId) { $website = $this->helper->storeManager->getWebsite($websiteId); $this->helper->updateDataFields($email, $website, $this->storeName); }
php
private function updateDefaultDatafields($email, $websiteId) { $website = $this->helper->storeManager->getWebsite($websiteId); $this->helper->updateDataFields($email, $website, $this->storeName); }
[ "private", "function", "updateDefaultDatafields", "(", "$", "email", ",", "$", "websiteId", ")", "{", "$", "website", "=", "$", "this", "->", "helper", "->", "storeManager", "->", "getWebsite", "(", "$", "websiteId", ")", ";", "$", "this", "->", "helper", ...
Update config datafield. @param string $email @param int $websiteId @return null @throws \Magento\Framework\Exception\LocalizedException
[ "Update", "config", "datafield", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L341-L345
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.updateNewOrderDatafields
private function updateNewOrderDatafields($websiteId) { $website = $this->helper->storeManager->getWebsite($websiteId); $orderModel = $this->orderFactory->create() ->loadByIncrementId($this->typeId); //data fields if ($lastOrderId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_ID ) ) { $data[] = [ 'Key' => $lastOrderId, 'Value' => $orderModel->getId(), ]; } if ($orderIncrementId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_INCREMENT_ID ) ) { $data[] = [ 'Key' => $orderIncrementId, 'Value' => $orderModel->getIncrementId(), ]; } if ($storeName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME ) ) { $data[] = [ 'Key' => $storeName, 'Value' => $this->storeName, ]; } if ($websiteName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME ) ) { $data[] = [ 'Key' => $websiteName, 'Value' => $website->getName(), ]; } if ($lastOrderDate = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_DATE ) ) { $data[] = [ 'Key' => $lastOrderDate, 'Value' => $orderModel->getCreatedAt(), ]; } if (($customerId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_ID )) && $orderModel->getCustomerId() ) { $data[] = [ 'Key' => $customerId, 'Value' => $orderModel->getCustomerId(), ]; } if (!empty($data)) { //update data fields $client = $this->helper->getWebsiteApiClient($website); $client->updateContactDatafieldsByEmail( $orderModel->getCustomerEmail(), $data ); } }
php
private function updateNewOrderDatafields($websiteId) { $website = $this->helper->storeManager->getWebsite($websiteId); $orderModel = $this->orderFactory->create() ->loadByIncrementId($this->typeId); //data fields if ($lastOrderId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_ID ) ) { $data[] = [ 'Key' => $lastOrderId, 'Value' => $orderModel->getId(), ]; } if ($orderIncrementId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_INCREMENT_ID ) ) { $data[] = [ 'Key' => $orderIncrementId, 'Value' => $orderModel->getIncrementId(), ]; } if ($storeName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME ) ) { $data[] = [ 'Key' => $storeName, 'Value' => $this->storeName, ]; } if ($websiteName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME ) ) { $data[] = [ 'Key' => $websiteName, 'Value' => $website->getName(), ]; } if ($lastOrderDate = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_DATE ) ) { $data[] = [ 'Key' => $lastOrderDate, 'Value' => $orderModel->getCreatedAt(), ]; } if (($customerId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_ID )) && $orderModel->getCustomerId() ) { $data[] = [ 'Key' => $customerId, 'Value' => $orderModel->getCustomerId(), ]; } if (!empty($data)) { //update data fields $client = $this->helper->getWebsiteApiClient($website); $client->updateContactDatafieldsByEmail( $orderModel->getCustomerEmail(), $data ); } }
[ "private", "function", "updateNewOrderDatafields", "(", "$", "websiteId", ")", "{", "$", "website", "=", "$", "this", "->", "helper", "->", "storeManager", "->", "getWebsite", "(", "$", "websiteId", ")", ";", "$", "orderModel", "=", "$", "this", "->", "ord...
Update new order default datafields. @param int $websiteId @return null @throws \Magento\Framework\Exception\LocalizedException
[ "Update", "new", "order", "default", "datafields", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L355-L425
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.checkCampignEnrolmentActive
private function checkCampignEnrolmentActive($programId, $websiteId) { //program is not set if (!$programId) { return false; } $client = $this->helper->getWebsiteApiClient($websiteId); $program = $client->getProgramById($programId); //program status if (isset($program->status)) { $this->programStatus = $program->status; } if (isset($program->status) && $program->status == 'Active') { return true; } return false; }
php
private function checkCampignEnrolmentActive($programId, $websiteId) { //program is not set if (!$programId) { return false; } $client = $this->helper->getWebsiteApiClient($websiteId); $program = $client->getProgramById($programId); //program status if (isset($program->status)) { $this->programStatus = $program->status; } if (isset($program->status) && $program->status == 'Active') { return true; } return false; }
[ "private", "function", "checkCampignEnrolmentActive", "(", "$", "programId", ",", "$", "websiteId", ")", "{", "//program is not set", "if", "(", "!", "$", "programId", ")", "{", "return", "false", ";", "}", "$", "client", "=", "$", "this", "->", "helper", ...
Program check if is valid and active. @param int $programId @param int $websiteId @return bool @throws \Exception
[ "Program", "check", "if", "is", "valid", "and", "active", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L436-L453
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.sendContactsToAutomation
private function sendContactsToAutomation($contacts, $websiteId) { $client = $this->helper->getWebsiteApiClient($websiteId); $data = [ 'Contacts' => $contacts, 'ProgramId' => $this->programId, 'AddressBooks' => [], ]; //api add contact to automation enrolment $result = $client->postProgramsEnrolments($data); return $result; }
php
private function sendContactsToAutomation($contacts, $websiteId) { $client = $this->helper->getWebsiteApiClient($websiteId); $data = [ 'Contacts' => $contacts, 'ProgramId' => $this->programId, 'AddressBooks' => [], ]; //api add contact to automation enrolment $result = $client->postProgramsEnrolments($data); return $result; }
[ "private", "function", "sendContactsToAutomation", "(", "$", "contacts", ",", "$", "websiteId", ")", "{", "$", "client", "=", "$", "this", "->", "helper", "->", "getWebsiteApiClient", "(", "$", "websiteId", ")", ";", "$", "data", "=", "[", "'Contacts'", "=...
Enrol contacts for a program. @param array $contacts @param int $websiteId @return mixed @throws \Exception
[ "Enrol", "contacts", "for", "a", "program", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L464-L476
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Automation.php
Automation.setupAutomationTypes
private function setupAutomationTypes() { $statusTypes = $this->automationFactory->create() ->getAutomationStatusType(); foreach ($statusTypes as $type) { $this->automationTypes[$type] = \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_ORDER_STATUS; } }
php
private function setupAutomationTypes() { $statusTypes = $this->automationFactory->create() ->getAutomationStatusType(); foreach ($statusTypes as $type) { $this->automationTypes[$type] = \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_ORDER_STATUS; } }
[ "private", "function", "setupAutomationTypes", "(", ")", "{", "$", "statusTypes", "=", "$", "this", "->", "automationFactory", "->", "create", "(", ")", "->", "getAutomationStatusType", "(", ")", ";", "foreach", "(", "$", "statusTypes", "as", "$", "type", ")...
Setup automation types @return null
[ "Setup", "automation", "types" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Automation.php#L483-L492
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Catalog/CatalogSyncFactory.php
CatalogSyncFactory.create
public function create() { $syncLevel = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VALUES ); if ($syncLevel == self::SYNC_CATALOG_DEFAULT_LEVEL) { return $this->defaultLevelCatalogSyncerFactory->create(); } elseif ($syncLevel == self::SYNC_CATALOG_STORE_LEVEL) { return $this->storeLevelCatalogSyncerFactory->create(); } return null; }
php
public function create() { $syncLevel = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VALUES ); if ($syncLevel == self::SYNC_CATALOG_DEFAULT_LEVEL) { return $this->defaultLevelCatalogSyncerFactory->create(); } elseif ($syncLevel == self::SYNC_CATALOG_STORE_LEVEL) { return $this->storeLevelCatalogSyncerFactory->create(); } return null; }
[ "public", "function", "create", "(", ")", "{", "$", "syncLevel", "=", "$", "this", "->", "scopeConfig", "->", "getValue", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_SYNC_CATALOG_VALUES", ")", ";", "if...
Create syncer class instance depending on configuration @return \Dotdigitalgroup\Email\Model\Sync\Catalog\CatalogSyncerInterface|null
[ "Create", "syncer", "class", "instance", "depending", "on", "configuration" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Catalog/CatalogSyncFactory.php#L50-L63
train
dotmailer/dotmailer-magento2-extension
Model/Catalog.php
Catalog.loadProductById
public function loadProductById($productId) { $collection = $this->catalogCollection->create() ->addFieldToFilter('product_id', $productId) ->setPageSize(1); return $collection->getFirstItem(); }
php
public function loadProductById($productId) { $collection = $this->catalogCollection->create() ->addFieldToFilter('product_id', $productId) ->setPageSize(1); return $collection->getFirstItem(); }
[ "public", "function", "loadProductById", "(", "$", "productId", ")", "{", "$", "collection", "=", "$", "this", "->", "catalogCollection", "->", "create", "(", ")", "->", "addFieldToFilter", "(", "'product_id'", ",", "$", "productId", ")", "->", "setPageSize", ...
Load by product id. @param int $productId @return \Dotdigitalgroup\Email\Model\Catalog
[ "Load", "by", "product", "id", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Catalog.php#L94-L101
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Campaign.php
Campaign.setSent
public function setSent($sendId) { $bind = [ 'send_status' => \Dotdigitalgroup\Email\Model\Campaign::SENT, 'sent_at' => $this->datetime->gmtDate() ]; $conn = $this->getConnection(); $conn->update( $this->getMainTable(), $bind, ['send_id = ?' => $sendId] ); }
php
public function setSent($sendId) { $bind = [ 'send_status' => \Dotdigitalgroup\Email\Model\Campaign::SENT, 'sent_at' => $this->datetime->gmtDate() ]; $conn = $this->getConnection(); $conn->update( $this->getMainTable(), $bind, ['send_id = ?' => $sendId] ); }
[ "public", "function", "setSent", "(", "$", "sendId", ")", "{", "$", "bind", "=", "[", "'send_status'", "=>", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Model", "\\", "Campaign", "::", "SENT", ",", "'sent_at'", "=>", "$", "this", "->", "datetime", "->...
Set sent. @param int $sendId @return null
[ "Set", "sent", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Campaign.php#L91-L103
train
dotmailer/dotmailer-magento2-extension
Console/Command/ImporterSyncsCommand.php
ImporterSyncsCommand.configure
protected function configure() { $this ->setName('dotdigital:sync') ->setDescription(__('Run syncs to populate email_ tables before importing to Engagement Cloud')) ->addArgument( 'sync', InputArgument::OPTIONAL, sprintf('%s (%s)', __('The name of the sync to run'), implode('; ', $this->syncProvider->getAvailableSyncs()) ) ) ; parent::configure(); }
php
protected function configure() { $this ->setName('dotdigital:sync') ->setDescription(__('Run syncs to populate email_ tables before importing to Engagement Cloud')) ->addArgument( 'sync', InputArgument::OPTIONAL, sprintf('%s (%s)', __('The name of the sync to run'), implode('; ', $this->syncProvider->getAvailableSyncs()) ) ) ; parent::configure(); }
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "'dotdigital:sync'", ")", "->", "setDescription", "(", "__", "(", "'Run syncs to populate email_ tables before importing to Engagement Cloud'", ")", ")", "->", "addArgument", "(", ...
Configure this command
[ "Configure", "this", "command" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Console/Command/ImporterSyncsCommand.php#L43-L58
train
dotmailer/dotmailer-magento2-extension
Model/Config/Configuration/Orderstatus.php
Orderstatus.toOptionArray
public function toOptionArray() { $statuses = $this->orderConfig->getStatuses(); $options[] = [ 'label' => __('---- Default Option ----'), 'value' => '0', ]; foreach ($statuses as $code => $label) { $options[] = ['value' => $code, 'label' => $label]; } return $options; }
php
public function toOptionArray() { $statuses = $this->orderConfig->getStatuses(); $options[] = [ 'label' => __('---- Default Option ----'), 'value' => '0', ]; foreach ($statuses as $code => $label) { $options[] = ['value' => $code, 'label' => $label]; } return $options; }
[ "public", "function", "toOptionArray", "(", ")", "{", "$", "statuses", "=", "$", "this", "->", "orderConfig", "->", "getStatuses", "(", ")", ";", "$", "options", "[", "]", "=", "[", "'label'", "=>", "__", "(", "'---- Default Option ----'", ")", ",", "'va...
Returns the order statuses for field order_statuses. @return array
[ "Returns", "the", "order", "statuses", "for", "field", "order_statuses", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Configuration/Orderstatus.php#L28-L42
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.run
public function run() { // truncate any tables which are about to be updated $this->emptyTables(); // loop through types and execute foreach ($this->dataMigrationTypeProvider->getTypes() as $dataMigration) { /** @var AbstractDataMigration $dataMigration */ $dataMigration->execute(); $this->logActions($dataMigration); } /** * Save config value */ $this->saveAllOrderStatusesAsString(); $this->saveAllProductTypesAsString(); $this->saveAllProductVisibilitiesAsString(); $this->generateAndSaveCode(); }
php
public function run() { // truncate any tables which are about to be updated $this->emptyTables(); // loop through types and execute foreach ($this->dataMigrationTypeProvider->getTypes() as $dataMigration) { /** @var AbstractDataMigration $dataMigration */ $dataMigration->execute(); $this->logActions($dataMigration); } /** * Save config value */ $this->saveAllOrderStatusesAsString(); $this->saveAllProductTypesAsString(); $this->saveAllProductVisibilitiesAsString(); $this->generateAndSaveCode(); }
[ "public", "function", "run", "(", ")", "{", "// truncate any tables which are about to be updated", "$", "this", "->", "emptyTables", "(", ")", ";", "// loop through types and execute", "foreach", "(", "$", "this", "->", "dataMigrationTypeProvider", "->", "getTypes", "(...
Run all install methods
[ "Run", "all", "install", "methods" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L97-L116
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.logActions
private function logActions(AbstractDataMigration $dataMigration) { $this->logger->debug('Dotdigitalgroup_Email data installer', [ 'type' => get_class($dataMigration), 'rows_affected' => $dataMigration->getRowsAffected(), ]); if ($this->output) { $this->output->writeln(sprintf('%s: rows affected %s', get_class($dataMigration), $dataMigration->getRowsAffected() )); } }
php
private function logActions(AbstractDataMigration $dataMigration) { $this->logger->debug('Dotdigitalgroup_Email data installer', [ 'type' => get_class($dataMigration), 'rows_affected' => $dataMigration->getRowsAffected(), ]); if ($this->output) { $this->output->writeln(sprintf('%s: rows affected %s', get_class($dataMigration), $dataMigration->getRowsAffected() )); } }
[ "private", "function", "logActions", "(", "AbstractDataMigration", "$", "dataMigration", ")", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Dotdigitalgroup_Email data installer'", ",", "[", "'type'", "=>", "get_class", "(", "$", "dataMigration", ")", ","...
Log actions of each data migration @param AbstractDataMigration $dataMigration
[ "Log", "actions", "of", "each", "data", "migration" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L133-L146
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.emptyTables
private function emptyTables() { foreach ($this->dataMigrationTypeProvider->getTypes() as $migrationType) { /** @var AbstractDataMigration $migrationType */ $tableName = $this->resourceConnection->getTableName($migrationType->getTableName()); $this->resourceConnection->getConnection()->delete($tableName); $this->resourceConnection->getConnection() ->query(sprintf('ALTER TABLE %s AUTO_INCREMENT = 1', $tableName)); } }
php
private function emptyTables() { foreach ($this->dataMigrationTypeProvider->getTypes() as $migrationType) { /** @var AbstractDataMigration $migrationType */ $tableName = $this->resourceConnection->getTableName($migrationType->getTableName()); $this->resourceConnection->getConnection()->delete($tableName); $this->resourceConnection->getConnection() ->query(sprintf('ALTER TABLE %s AUTO_INCREMENT = 1', $tableName)); } }
[ "private", "function", "emptyTables", "(", ")", "{", "foreach", "(", "$", "this", "->", "dataMigrationTypeProvider", "->", "getTypes", "(", ")", "as", "$", "migrationType", ")", "{", "/** @var AbstractDataMigration $migrationType */", "$", "tableName", "=", "$", "...
Truncate relevant tables before running
[ "Truncate", "relevant", "tables", "before", "running" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L151-L161
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.saveAllOrderStatusesAsString
private function saveAllOrderStatusesAsString() { $options = array_keys($this->orderConfig->getStatuses()); $statusString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_STATUS, $statusString, 'website', 0 ); }
php
private function saveAllOrderStatusesAsString() { $options = array_keys($this->orderConfig->getStatuses()); $statusString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_STATUS, $statusString, 'website', 0 ); }
[ "private", "function", "saveAllOrderStatusesAsString", "(", ")", "{", "$", "options", "=", "array_keys", "(", "$", "this", "->", "orderConfig", "->", "getStatuses", "(", ")", ")", ";", "$", "statusString", "=", "implode", "(", "','", ",", "$", "options", "...
Get all order statuses and save in config
[ "Get", "all", "order", "statuses", "and", "save", "in", "config" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L166-L176
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.saveAllProductTypesAsString
private function saveAllProductTypesAsString() { $types = $this->typeFactory ->create() ->toOptionArray(); $options = []; foreach ($types as $type) { $options[] = $type['value']; } $typeString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_TYPE, $typeString, 'website', '0' ); }
php
private function saveAllProductTypesAsString() { $types = $this->typeFactory ->create() ->toOptionArray(); $options = []; foreach ($types as $type) { $options[] = $type['value']; } $typeString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_TYPE, $typeString, 'website', '0' ); }
[ "private", "function", "saveAllProductTypesAsString", "(", ")", "{", "$", "types", "=", "$", "this", "->", "typeFactory", "->", "create", "(", ")", "->", "toOptionArray", "(", ")", ";", "$", "options", "=", "[", "]", ";", "foreach", "(", "$", "types", ...
Get all product types and save in config
[ "Get", "all", "product", "types", "and", "save", "in", "config" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L181-L197
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.saveAllProductVisibilitiesAsString
private function saveAllProductVisibilitiesAsString() { $visibilities = $this->visibilityFactory ->create() ->toOptionArray(); $options = []; foreach ($visibilities as $visibility) { $options[] = $visibility['value']; } $visibilityString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VISIBILITY, $visibilityString, 'website', '0' ); }
php
private function saveAllProductVisibilitiesAsString() { $visibilities = $this->visibilityFactory ->create() ->toOptionArray(); $options = []; foreach ($visibilities as $visibility) { $options[] = $visibility['value']; } $visibilityString = implode(',', $options); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VISIBILITY, $visibilityString, 'website', '0' ); }
[ "private", "function", "saveAllProductVisibilitiesAsString", "(", ")", "{", "$", "visibilities", "=", "$", "this", "->", "visibilityFactory", "->", "create", "(", ")", "->", "toOptionArray", "(", ")", ";", "$", "options", "=", "[", "]", ";", "foreach", "(", ...
Get all product visibility types and save in config
[ "Get", "all", "product", "visibility", "types", "and", "save", "in", "config" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L202-L218
train
dotmailer/dotmailer-magento2-extension
Setup/Install/DataMigrationHelper.php
DataMigrationHelper.generateAndSaveCode
private function generateAndSaveCode() { $code = $this->randomMath->getRandomString(32); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $code, 'default', '0' ); }
php
private function generateAndSaveCode() { $code = $this->randomMath->getRandomString(32); $this->config->saveConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $code, 'default', '0' ); }
[ "private", "function", "generateAndSaveCode", "(", ")", "{", "$", "code", "=", "$", "this", "->", "randomMath", "->", "getRandomString", "(", "32", ")", ";", "$", "this", "->", "config", "->", "saveConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\"...
Generate a random string and save in config @throws \Magento\Framework\Exception\LocalizedException
[ "Generate", "a", "random", "string", "and", "save", "in", "config" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Install/DataMigrationHelper.php#L224-L233
train
dotmailer/dotmailer-magento2-extension
Block/Adminhtml/Rules/Edit.php
Edit.getHeaderText
public function getHeaderText() { $rule = $this->registry->registry('current_ddg_rule'); if ($rule->getId()) { return __('Edit Rule %1', $this->escapeHtml($rule->getName())); } else { return __('New Rule'); } }
php
public function getHeaderText() { $rule = $this->registry->registry('current_ddg_rule'); if ($rule->getId()) { return __('Edit Rule %1', $this->escapeHtml($rule->getName())); } else { return __('New Rule'); } }
[ "public", "function", "getHeaderText", "(", ")", "{", "$", "rule", "=", "$", "this", "->", "registry", "->", "registry", "(", "'current_ddg_rule'", ")", ";", "if", "(", "$", "rule", "->", "getId", "(", ")", ")", "{", "return", "__", "(", "'Edit Rule %1...
Getter for form header text. @return string
[ "Getter", "for", "form", "header", "text", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Rules/Edit.php#L42-L51
train
dotmailer/dotmailer-magento2-extension
Model/Newsletter/Subscriber.php
Subscriber.exportSubscribersPerWebsite
public function exportSubscribersPerWebsite($website) { $isSubscriberSalesDataEnabled = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ENABLE_SUBSCRIBER_SALES_DATA, $website ); $updated = 0; $limit = $this->helper->getSyncLimit($website->getId()); //subscriber collection to import $emailContactModel = $this->contactFactory->create(); //Customer Subscribers $subscribersAreCustomers = $emailContactModel->getSubscribersToImport($website, $limit); //Guest Subscribers $subscribersAreGuest = $emailContactModel->getSubscribersToImport($website, $limit, false); $subscribersGuestEmails = $subscribersAreGuest->getColumnValues('email'); $existInSales = []; //Only if subscriber with sales data enabled if ($isSubscriberSalesDataEnabled && ! empty($subscribersGuestEmails)) { $existInSales = $this->checkInSales($subscribersGuestEmails); } $emailsNotInSales = array_diff($subscribersGuestEmails, $existInSales); $customerSubscribers = $subscribersAreCustomers->getColumnValues('email'); $emailsWithNoSaleData = array_merge($emailsNotInSales, $customerSubscribers); //subscriber that are customer or/and the one that do not exist in sales order table. $subscribersWithNoSaleData = []; if (! empty($emailsWithNoSaleData)) { $subscribersWithNoSaleData = $emailContactModel ->getSubscribersToImportFromEmails($emailsWithNoSaleData); } if (! empty($subscribersWithNoSaleData)) { $updated += $this->subscriberExporter->exportSubscribers( $website, $subscribersWithNoSaleData ); //add updated number for the website $this->countSubscribers += $updated; } //subscriber that are guest and also exist in sales order table. $subscribersWithSaleData = []; if (! empty($existInSales)) { $subscribersWithSaleData = $emailContactModel->getSubscribersToImportFromEmails($existInSales); } if (! empty($subscribersWithSaleData)) { $updated += $this->subscriberWithSalesExporter->exportSubscribersWithSales( $website, $subscribersWithSaleData ); //add updated number for the website $this->countSubscribers += $updated; } return $updated; }
php
public function exportSubscribersPerWebsite($website) { $isSubscriberSalesDataEnabled = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ENABLE_SUBSCRIBER_SALES_DATA, $website ); $updated = 0; $limit = $this->helper->getSyncLimit($website->getId()); //subscriber collection to import $emailContactModel = $this->contactFactory->create(); //Customer Subscribers $subscribersAreCustomers = $emailContactModel->getSubscribersToImport($website, $limit); //Guest Subscribers $subscribersAreGuest = $emailContactModel->getSubscribersToImport($website, $limit, false); $subscribersGuestEmails = $subscribersAreGuest->getColumnValues('email'); $existInSales = []; //Only if subscriber with sales data enabled if ($isSubscriberSalesDataEnabled && ! empty($subscribersGuestEmails)) { $existInSales = $this->checkInSales($subscribersGuestEmails); } $emailsNotInSales = array_diff($subscribersGuestEmails, $existInSales); $customerSubscribers = $subscribersAreCustomers->getColumnValues('email'); $emailsWithNoSaleData = array_merge($emailsNotInSales, $customerSubscribers); //subscriber that are customer or/and the one that do not exist in sales order table. $subscribersWithNoSaleData = []; if (! empty($emailsWithNoSaleData)) { $subscribersWithNoSaleData = $emailContactModel ->getSubscribersToImportFromEmails($emailsWithNoSaleData); } if (! empty($subscribersWithNoSaleData)) { $updated += $this->subscriberExporter->exportSubscribers( $website, $subscribersWithNoSaleData ); //add updated number for the website $this->countSubscribers += $updated; } //subscriber that are guest and also exist in sales order table. $subscribersWithSaleData = []; if (! empty($existInSales)) { $subscribersWithSaleData = $emailContactModel->getSubscribersToImportFromEmails($existInSales); } if (! empty($subscribersWithSaleData)) { $updated += $this->subscriberWithSalesExporter->exportSubscribersWithSales( $website, $subscribersWithSaleData ); //add updated number for the website $this->countSubscribers += $updated; } return $updated; }
[ "public", "function", "exportSubscribersPerWebsite", "(", "$", "website", ")", "{", "$", "isSubscriberSalesDataEnabled", "=", "$", "this", "->", "helper", "->", "getWebsiteConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", ...
Export subscribers per website. @param \Magento\Store\Model\Website $website @return int @throws LocalizedException
[ "Export", "subscribers", "per", "website", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Newsletter/Subscriber.php#L148-L202
train
dotmailer/dotmailer-magento2-extension
Model/Newsletter/Subscriber.php
Subscriber.unsubscribe
public function unsubscribe() { $result['customers'] = 0; $suppressedEmails = []; /** * Sync all suppressed for each store */ $websites = $this->helper->getWebsites(true); foreach ($websites as $website) { //not enabled if (! $this->helper->isEnabled($website)) { continue; } $suppressedEmails = $this->getSuppressedContacts($website); } //Mark suppressed contacts if (! empty($suppressedEmails)) { $result['customers'] = $this->emailContactResource->unsubscribe($suppressedEmails); } return $result; }
php
public function unsubscribe() { $result['customers'] = 0; $suppressedEmails = []; /** * Sync all suppressed for each store */ $websites = $this->helper->getWebsites(true); foreach ($websites as $website) { //not enabled if (! $this->helper->isEnabled($website)) { continue; } $suppressedEmails = $this->getSuppressedContacts($website); } //Mark suppressed contacts if (! empty($suppressedEmails)) { $result['customers'] = $this->emailContactResource->unsubscribe($suppressedEmails); } return $result; }
[ "public", "function", "unsubscribe", "(", ")", "{", "$", "result", "[", "'customers'", "]", "=", "0", ";", "$", "suppressedEmails", "=", "[", "]", ";", "/**\n * Sync all suppressed for each store\n */", "$", "websites", "=", "$", "this", "->", "h...
Un-subscribe suppressed contacts. @return array
[ "Un", "-", "subscribe", "suppressed", "contacts", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Newsletter/Subscriber.php#L222-L245
train
dotmailer/dotmailer-magento2-extension
Block/Recommended/Recentlyviewed.php
Recentlyviewed.getLoadedProductCollection
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); //check for param code and id if (! isset($params['customer_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Recently viewed no id or valid code is set'); return []; } $productsToDisplay = []; $mode = $this->getRequest()->getActionName(); $customerId = (int) $this->getRequest()->getParam('customer_id'); $limit = (int) $this->recommnededHelper->getDisplayLimitByMode($mode); //login customer to receive the recent products $session = $this->sessionFactory->create(); $isLoggedIn = $session->loginById($customerId); $productIds = $this->catalog->getRecentlyViewed($customerId, $limit); //get product collection to check for salable $productCollection = $this->catalog->getProductCollectionFromIds($productIds); //show products only if is salable foreach ($productCollection as $product) { if ($product->isSalable()) { $productsToDisplay[$product->getId()] = $product; } } $this->helper->log( 'Recentlyviewed customer : ' . $customerId . ', mode ' . $mode . ', limit : ' . $limit . ', items found : ' . count($productIds) . ', is customer logged in : ' . $isLoggedIn . ', products :' . count($productsToDisplay) ); $session->logout(); return $productsToDisplay; }
php
public function getLoadedProductCollection() { $params = $this->getRequest()->getParams(); //check for param code and id if (! isset($params['customer_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Recently viewed no id or valid code is set'); return []; } $productsToDisplay = []; $mode = $this->getRequest()->getActionName(); $customerId = (int) $this->getRequest()->getParam('customer_id'); $limit = (int) $this->recommnededHelper->getDisplayLimitByMode($mode); //login customer to receive the recent products $session = $this->sessionFactory->create(); $isLoggedIn = $session->loginById($customerId); $productIds = $this->catalog->getRecentlyViewed($customerId, $limit); //get product collection to check for salable $productCollection = $this->catalog->getProductCollectionFromIds($productIds); //show products only if is salable foreach ($productCollection as $product) { if ($product->isSalable()) { $productsToDisplay[$product->getId()] = $product; } } $this->helper->log( 'Recentlyviewed customer : ' . $customerId . ', mode ' . $mode . ', limit : ' . $limit . ', items found : ' . count($productIds) . ', is customer logged in : ' . $isLoggedIn . ', products :' . count($productsToDisplay) ); $session->logout(); return $productsToDisplay; }
[ "public", "function", "getLoadedProductCollection", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParams", "(", ")", ";", "//check for param code and id", "if", "(", "!", "isset", "(", "$", "params", "[", "'customer_...
Products collection. @return array
[ "Products", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Recommended/Recentlyviewed.php#L78-L119
train
dotmailer/dotmailer-magento2-extension
Block/Basket.php
Basket.getBasketItems
public function getBasketItems() { $params = $this->getRequest()->getParams(); if (! isset($params['quote_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Abandoned cart not found or invalid code'); return false; } $quoteId = (int) $params['quote_id']; $quoteModel = $this->quoteFactory->create() ->loadByIdWithoutStore($quoteId); //check for any quote for this email, don't want to render further if (!$quoteModel->getId()) { $this->helper->log('no quote found for ' . $quoteId); return false; } if (!$quoteModel->getIsActive()) { $this->helper->log('Cart is not active : ' . $quoteId); return false; } $this->quote = $quoteModel; //Start environment emulation of the specified store $storeId = $quoteModel->getStoreId(); $appEmulation = $this->emulationFactory->create(); $appEmulation->startEnvironmentEmulation($storeId); $quoteItems = $quoteModel->getAllItems(); $itemsData = []; /** @var \Magento\Quote\Model\Quote\Item $quoteItem */ $parentProductIds = []; //Collect all parent ids to identify later which products to show in EDC foreach ($quoteItems as $quoteItem) { if ($quoteItem->getParentItemId() == null) { $parentProductIds[] = $quoteItem->getProduct()->getId(); } } foreach ($quoteItems as $quoteItem) { if ($quoteItem->getParentItemId() != null) { //If a product is a bundle we don't need to show all parts of it. if ($quoteItem->getParentItem()->getProductType() == 'bundle') { continue; } $itemsData[] = $this->getItemDataForChildProducts($quoteItem); //Signal that we added a child product, so its parent must be ignored later. if (in_array($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds)) { $key = array_search($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds); unset($parentProductIds[$key]); } } } foreach ($quoteItems as $quoteItem) { //If a child product added already, we must not add it's parent. if ($quoteItem->getParentItemId() == null && in_array($quoteItem->getProduct()->getId(), $parentProductIds)) { $itemsData[] = $this->getItemDataForParentProducts($quoteItem); } } return $itemsData; }
php
public function getBasketItems() { $params = $this->getRequest()->getParams(); if (! isset($params['quote_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code']) ) { $this->helper->log('Abandoned cart not found or invalid code'); return false; } $quoteId = (int) $params['quote_id']; $quoteModel = $this->quoteFactory->create() ->loadByIdWithoutStore($quoteId); //check for any quote for this email, don't want to render further if (!$quoteModel->getId()) { $this->helper->log('no quote found for ' . $quoteId); return false; } if (!$quoteModel->getIsActive()) { $this->helper->log('Cart is not active : ' . $quoteId); return false; } $this->quote = $quoteModel; //Start environment emulation of the specified store $storeId = $quoteModel->getStoreId(); $appEmulation = $this->emulationFactory->create(); $appEmulation->startEnvironmentEmulation($storeId); $quoteItems = $quoteModel->getAllItems(); $itemsData = []; /** @var \Magento\Quote\Model\Quote\Item $quoteItem */ $parentProductIds = []; //Collect all parent ids to identify later which products to show in EDC foreach ($quoteItems as $quoteItem) { if ($quoteItem->getParentItemId() == null) { $parentProductIds[] = $quoteItem->getProduct()->getId(); } } foreach ($quoteItems as $quoteItem) { if ($quoteItem->getParentItemId() != null) { //If a product is a bundle we don't need to show all parts of it. if ($quoteItem->getParentItem()->getProductType() == 'bundle') { continue; } $itemsData[] = $this->getItemDataForChildProducts($quoteItem); //Signal that we added a child product, so its parent must be ignored later. if (in_array($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds)) { $key = array_search($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds); unset($parentProductIds[$key]); } } } foreach ($quoteItems as $quoteItem) { //If a child product added already, we must not add it's parent. if ($quoteItem->getParentItemId() == null && in_array($quoteItem->getProduct()->getId(), $parentProductIds)) { $itemsData[] = $this->getItemDataForParentProducts($quoteItem); } } return $itemsData; }
[ "public", "function", "getBasketItems", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParams", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "params", "[", "'quote_id'", "]", ")", "||", "!", "isset", "(...
Basket items. @return array
[ "Basket", "items", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Basket.php#L80-L153
train
dotmailer/dotmailer-magento2-extension
Block/Basket.php
Basket.getItemsData
private function getItemsData($quoteItem, $_product, $_parentProduct) { $totalPrice = (!isset($_parentProduct) ? $quoteItem->getBaseRowTotalInclTax() : $quoteItem->getParentItem()->getBaseRowTotalInclTax()); $inStock = ($_product->isInStock()) ? 'In Stock' : 'Out of stock'; $total = $this->priceHelper->currency( $totalPrice, true, false ); $productUrl = (isset($_parentProduct) ? $this->urlFinder->fetchFor($_parentProduct) : $this->urlFinder->fetchFor($_product)); $grandTotal = $this->priceHelper->currency( $this->getGrandTotal(), true, false ); $itemsData = [ 'grandTotal' => $grandTotal, 'total' => $total, 'inStock' => $inStock, 'productUrl' => $productUrl, 'product' => (isset($_parentProduct) ? $_parentProduct : $_product), 'qty' => isset($_parentProduct) ? $quoteItem->getParentItem()->getQty() : $quoteItem->getQty(), 'product_details' => $_product ]; return $itemsData; }
php
private function getItemsData($quoteItem, $_product, $_parentProduct) { $totalPrice = (!isset($_parentProduct) ? $quoteItem->getBaseRowTotalInclTax() : $quoteItem->getParentItem()->getBaseRowTotalInclTax()); $inStock = ($_product->isInStock()) ? 'In Stock' : 'Out of stock'; $total = $this->priceHelper->currency( $totalPrice, true, false ); $productUrl = (isset($_parentProduct) ? $this->urlFinder->fetchFor($_parentProduct) : $this->urlFinder->fetchFor($_product)); $grandTotal = $this->priceHelper->currency( $this->getGrandTotal(), true, false ); $itemsData = [ 'grandTotal' => $grandTotal, 'total' => $total, 'inStock' => $inStock, 'productUrl' => $productUrl, 'product' => (isset($_parentProduct) ? $_parentProduct : $_product), 'qty' => isset($_parentProduct) ? $quoteItem->getParentItem()->getQty() : $quoteItem->getQty(), 'product_details' => $_product ]; return $itemsData; }
[ "private", "function", "getItemsData", "(", "$", "quoteItem", ",", "$", "_product", ",", "$", "_parentProduct", ")", "{", "$", "totalPrice", "=", "(", "!", "isset", "(", "$", "_parentProduct", ")", "?", "$", "quoteItem", "->", "getBaseRowTotalInclTax", "(", ...
Returns the itemsData array to be viewed; @var \Magento\Quote\Model\Quote\Item $quoteItem @param Product $_product @param Product$_parentProduct @return array
[ "Returns", "the", "itemsData", "array", "to", "be", "viewed", ";" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Basket.php#L189-L218
train
dotmailer/dotmailer-magento2-extension
Block/Basket.php
Basket.canShowUrl
public function canShowUrl() { return (boolean)$this->quote->getStore()->getWebsite()->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_LINK_ENABLED ); }
php
public function canShowUrl() { return (boolean)$this->quote->getStore()->getWebsite()->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_LINK_ENABLED ); }
[ "public", "function", "canShowUrl", "(", ")", "{", "return", "(", "boolean", ")", "$", "this", "->", "quote", "->", "getStore", "(", ")", "->", "getWebsite", "(", ")", "->", "getConfig", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", ...
Can show go to basket url. @return bool
[ "Can", "show", "go", "to", "basket", "url", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Basket.php#L247-L252
train
dotmailer/dotmailer-magento2-extension
Block/Adminhtml/Dashboard/Information.php
Information.getApiValid
public function getApiValid() { $apiUsername = $this->helper->getApiUsername(); $apiPassword = $this->helper->getApiPassword(); $result = $this->test->validate($apiUsername, $apiPassword); return ($result)? '<span class="message message-success">Valid</span>' : '<span class="message message-error">Not Valid</span>'; }
php
public function getApiValid() { $apiUsername = $this->helper->getApiUsername(); $apiPassword = $this->helper->getApiPassword(); $result = $this->test->validate($apiUsername, $apiPassword); return ($result)? '<span class="message message-success">Valid</span>' : '<span class="message message-error">Not Valid</span>'; }
[ "public", "function", "getApiValid", "(", ")", "{", "$", "apiUsername", "=", "$", "this", "->", "helper", "->", "getApiUsername", "(", ")", ";", "$", "apiPassword", "=", "$", "this", "->", "helper", "->", "getApiPassword", "(", ")", ";", "$", "result", ...
Get the api creds are valid. @return string
[ "Get", "the", "api", "creds", "are", "valid", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Dashboard/Information.php#L113-L122
train
dotmailer/dotmailer-magento2-extension
Block/Adminhtml/Dashboard/Information.php
Information.getCronLastExecution
public function getCronLastExecution() { $date = $this->escapeHtml($this->helper->getDateLastCronRun('ddg_automation_importer')); if (! $date) { $date = '<span class="message message-error">No cron found</span>'; } return $date; }
php
public function getCronLastExecution() { $date = $this->escapeHtml($this->helper->getDateLastCronRun('ddg_automation_importer')); if (! $date) { $date = '<span class="message message-error">No cron found</span>'; } return $date; }
[ "public", "function", "getCronLastExecution", "(", ")", "{", "$", "date", "=", "$", "this", "->", "escapeHtml", "(", "$", "this", "->", "helper", "->", "getDateLastCronRun", "(", "'ddg_automation_importer'", ")", ")", ";", "if", "(", "!", "$", "date", ")",...
Get the last successful execution for import. @return string
[ "Get", "the", "last", "successful", "execution", "for", "import", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Dashboard/Information.php#L129-L138
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.contactSync
public function contactSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_customer_subscriber_guest_sync')) { $message = 'Skipping ddg_automation_customer_subscriber_guest_sync job run'; $this->helper->log($message); return ['message' => $message]; } //run the sync for contacts $result = $this->contactFactory->create() ->sync(); //run subscribers and guests sync $subscriberResult = $this->subscribersAndGuestSync(); if (isset($subscriberResult['message']) && isset($result['message'])) { $result['message'] = $result['message'] . ' - ' . $subscriberResult['message']; } return $result; }
php
public function contactSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_customer_subscriber_guest_sync')) { $message = 'Skipping ddg_automation_customer_subscriber_guest_sync job run'; $this->helper->log($message); return ['message' => $message]; } //run the sync for contacts $result = $this->contactFactory->create() ->sync(); //run subscribers and guests sync $subscriberResult = $this->subscribersAndGuestSync(); if (isset($subscriberResult['message']) && isset($result['message'])) { $result['message'] = $result['message'] . ' - ' . $subscriberResult['message']; } return $result; }
[ "public", "function", "contactSync", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_customer_subscriber_guest_sync'", ")", ")", "{", "$", "message", "=", "'Skipping ddg_automation_customer_subscriber_guest_sync job run'", ";", "...
CRON FOR CONTACTS SYNC. @return array
[ "CRON", "FOR", "CONTACTS", "SYNC", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L148-L168
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.subscribersAndGuestSync
public function subscribersAndGuestSync() { //sync subscribers $subscriberModel = $this->subscriberFactory->create(); $result = $subscriberModel->sync(); //un-subscribe suppressed contacts $subscriberModel->unsubscribe(); //sync guests $this->guestFactory->create()->sync(); return $result; }
php
public function subscribersAndGuestSync() { //sync subscribers $subscriberModel = $this->subscriberFactory->create(); $result = $subscriberModel->sync(); //un-subscribe suppressed contacts $subscriberModel->unsubscribe(); //sync guests $this->guestFactory->create()->sync(); return $result; }
[ "public", "function", "subscribersAndGuestSync", "(", ")", "{", "//sync subscribers", "$", "subscriberModel", "=", "$", "this", "->", "subscriberFactory", "->", "create", "(", ")", ";", "$", "result", "=", "$", "subscriberModel", "->", "sync", "(", ")", ";", ...
CRON FOR SUBSCRIBERS AND GUEST CONTACTS. @return array
[ "CRON", "FOR", "SUBSCRIBERS", "AND", "GUEST", "CONTACTS", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L175-L188
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.catalogSync
public function catalogSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_catalog_sync')) { $message = 'Skipping ddg_automation_catalog_sync job run'; $this->helper->log($message); return ['message' => $message]; } $result = $this->catalogFactory->create() ->sync(); return $result; }
php
public function catalogSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_catalog_sync')) { $message = 'Skipping ddg_automation_catalog_sync job run'; $this->helper->log($message); return ['message' => $message]; } $result = $this->catalogFactory->create() ->sync(); return $result; }
[ "public", "function", "catalogSync", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_catalog_sync'", ")", ")", "{", "$", "message", "=", "'Skipping ddg_automation_catalog_sync job run'", ";", "$", "this", "->", "helper", ...
CRON FOR CATALOG SYNC. @return array
[ "CRON", "FOR", "CATALOG", "SYNC", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L195-L207
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.emailImporter
public function emailImporter() { if ($this->jobHasAlreadyBeenRun('ddg_automation_importer')) { $this->helper->log('Skipping ddg_automation_importer job run'); return; } $this->importerFactory->create()->processQueue(); }
php
public function emailImporter() { if ($this->jobHasAlreadyBeenRun('ddg_automation_importer')) { $this->helper->log('Skipping ddg_automation_importer job run'); return; } $this->importerFactory->create()->processQueue(); }
[ "public", "function", "emailImporter", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_importer'", ")", ")", "{", "$", "this", "->", "helper", "->", "log", "(", "'Skipping ddg_automation_importer job run'", ")", ";", "r...
CRON FOR EMAIL IMPORTER PROCESSOR. @return null
[ "CRON", "FOR", "EMAIL", "IMPORTER", "PROCESSOR", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L214-L222
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.reviewsAndWishlist
public function reviewsAndWishlist() { if ($this->jobHasAlreadyBeenRun('ddg_automation_reviews_and_wishlist')) { $this->helper->log('Skipping ddg_automation_reviews_and_wishlist job run'); return; } //sync reviews $this->reviewSync(); //sync wishlist $this->cronHelper->wishlistSync(); }
php
public function reviewsAndWishlist() { if ($this->jobHasAlreadyBeenRun('ddg_automation_reviews_and_wishlist')) { $this->helper->log('Skipping ddg_automation_reviews_and_wishlist job run'); return; } //sync reviews $this->reviewSync(); //sync wishlist $this->cronHelper->wishlistSync(); }
[ "public", "function", "reviewsAndWishlist", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_reviews_and_wishlist'", ")", ")", "{", "$", "this", "->", "helper", "->", "log", "(", "'Skipping ddg_automation_reviews_and_wishlist ...
CRON FOR SYNC REVIEWS and REGISTER ORDER REVIEW CAMPAIGNS. @return null
[ "CRON", "FOR", "SYNC", "REVIEWS", "and", "REGISTER", "ORDER", "REVIEW", "CAMPAIGNS", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L229-L240
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.abandonedCarts
public function abandonedCarts() { if ($this->jobHasAlreadyBeenRun('ddg_automation_abandonedcarts')) { $this->helper->log('Skipping ddg_automation_abandonedcarts job run'); return; } $this->quoteFactory->create()->processAbandonedCarts(); $this->abandonedCartProgramEnroller->process(); }
php
public function abandonedCarts() { if ($this->jobHasAlreadyBeenRun('ddg_automation_abandonedcarts')) { $this->helper->log('Skipping ddg_automation_abandonedcarts job run'); return; } $this->quoteFactory->create()->processAbandonedCarts(); $this->abandonedCartProgramEnroller->process(); }
[ "public", "function", "abandonedCarts", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_abandonedcarts'", ")", ")", "{", "$", "this", "->", "helper", "->", "log", "(", "'Skipping ddg_automation_abandonedcarts job run'", ")"...
CRON FOR ABANDONED CARTS. @return null
[ "CRON", "FOR", "ABANDONED", "CARTS", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L257-L266
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.syncAutomation
public function syncAutomation() { if ($this->jobHasAlreadyBeenRun('ddg_automation_status')) { $this->helper->log('Skipping ddg_automation_status job run'); return; } $this->automationFactory->create()->sync(); }
php
public function syncAutomation() { if ($this->jobHasAlreadyBeenRun('ddg_automation_status')) { $this->helper->log('Skipping ddg_automation_status job run'); return; } $this->automationFactory->create()->sync(); }
[ "public", "function", "syncAutomation", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_status'", ")", ")", "{", "$", "this", "->", "helper", "->", "log", "(", "'Skipping ddg_automation_status job run'", ")", ";", "retu...
CRON FOR AUTOMATION. @return null
[ "CRON", "FOR", "AUTOMATION", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L273-L281
train