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
Model/Cron.php
Cron.sendCampaigns
public function sendCampaigns() { if ($this->jobHasAlreadyBeenRun('ddg_automation_campaign')) { $this->helper->log('Skipping ddg_automation_campaign job run'); return; } $this->campaignFactory->create()->sendCampaigns(); }
php
public function sendCampaigns() { if ($this->jobHasAlreadyBeenRun('ddg_automation_campaign')) { $this->helper->log('Skipping ddg_automation_campaign job run'); return; } $this->campaignFactory->create()->sendCampaigns(); }
[ "public", "function", "sendCampaigns", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_campaign'", ")", ")", "{", "$", "this", "->", "helper", "->", "log", "(", "'Skipping ddg_automation_campaign job run'", ")", ";", "r...
Send email campaigns. @throws \Magento\Framework\Exception\LocalizedException @return null
[ "Send", "email", "campaigns", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L290-L298
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.orderSync
public function orderSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_order_sync')) { $message = 'Skipping ddg_automation_order_sync job run'; $this->helper->log($message); return ['message' => $message]; } // send order $orderResult = $this->syncOrderFactory->create() ->sync(); return $orderResult; }
php
public function orderSync() { if ($this->jobHasAlreadyBeenRun('ddg_automation_order_sync')) { $message = 'Skipping ddg_automation_order_sync job run'; $this->helper->log($message); return ['message' => $message]; } // send order $orderResult = $this->syncOrderFactory->create() ->sync(); return $orderResult; }
[ "public", "function", "orderSync", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_order_sync'", ")", ")", "{", "$", "message", "=", "'Skipping ddg_automation_order_sync job run'", ";", "$", "this", "->", "helper", "->", ...
CRON FOR ORDER TRANSACTIONAL DATA. @return array
[ "CRON", "FOR", "ORDER", "TRANSACTIONAL", "DATA", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L305-L318
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.cleaning
public function cleaning() { if ($this->jobHasAlreadyBeenRun('ddg_automation_cleaner')) { $message = 'Skipping ddg_automation_cleaner job run'; $this->helper->log($message); return $message; } //Clean tables $tables = [ 'automation' => Schema::EMAIL_AUTOMATION_TABLE, 'importer' => Schema::EMAIL_IMPORTER_TABLE, 'campaign' => Schema::EMAIL_CAMPAIGN_TABLE, ]; $message = 'Cleaning cron job result :'; foreach ($tables as $key => $table) { $result = $this->importerResource->cleanup($table); $message .= " $result records removed from $key ."; } $archivedFolder = $this->fileHelper->getArchiveFolder(); $result = $this->fileHelper->deleteDir($archivedFolder); $message .= ' Deleting archived folder result : ' . $result; $this->helper->log($message); return $message; }
php
public function cleaning() { if ($this->jobHasAlreadyBeenRun('ddg_automation_cleaner')) { $message = 'Skipping ddg_automation_cleaner job run'; $this->helper->log($message); return $message; } //Clean tables $tables = [ 'automation' => Schema::EMAIL_AUTOMATION_TABLE, 'importer' => Schema::EMAIL_IMPORTER_TABLE, 'campaign' => Schema::EMAIL_CAMPAIGN_TABLE, ]; $message = 'Cleaning cron job result :'; foreach ($tables as $key => $table) { $result = $this->importerResource->cleanup($table); $message .= " $result records removed from $key ."; } $archivedFolder = $this->fileHelper->getArchiveFolder(); $result = $this->fileHelper->deleteDir($archivedFolder); $message .= ' Deleting archived folder result : ' . $result; $this->helper->log($message); return $message; }
[ "public", "function", "cleaning", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_cleaner'", ")", ")", "{", "$", "message", "=", "'Skipping ddg_automation_cleaner job run'", ";", "$", "this", "->", "helper", "->", "log"...
Cleaning for csv files and connector tables. @return string
[ "Cleaning", "for", "csv", "files", "and", "connector", "tables", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L325-L351
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.jobHasAlreadyBeenRun
private function jobHasAlreadyBeenRun($jobCode) { $currentRunningJob = $this->cronCollection->create() ->addFieldToFilter('job_code', $jobCode) ->addFieldToFilter('status', 'running') ->setPageSize(1); if ($currentRunningJob->getSize()) { $jobOfSameTypeAndScheduledAtDateAlreadyExecuted = $this->cronCollection->create() ->addFieldToFilter('job_code', $jobCode) ->addFieldToFilter('scheduled_at', $currentRunningJob->getFirstItem()->getScheduledAt()) ->addFieldToFilter('status', ['in' => ['success', 'failed']]); return ($jobOfSameTypeAndScheduledAtDateAlreadyExecuted->getSize()) ? true : false; } return false; }
php
private function jobHasAlreadyBeenRun($jobCode) { $currentRunningJob = $this->cronCollection->create() ->addFieldToFilter('job_code', $jobCode) ->addFieldToFilter('status', 'running') ->setPageSize(1); if ($currentRunningJob->getSize()) { $jobOfSameTypeAndScheduledAtDateAlreadyExecuted = $this->cronCollection->create() ->addFieldToFilter('job_code', $jobCode) ->addFieldToFilter('scheduled_at', $currentRunningJob->getFirstItem()->getScheduledAt()) ->addFieldToFilter('status', ['in' => ['success', 'failed']]); return ($jobOfSameTypeAndScheduledAtDateAlreadyExecuted->getSize()) ? true : false; } return false; }
[ "private", "function", "jobHasAlreadyBeenRun", "(", "$", "jobCode", ")", "{", "$", "currentRunningJob", "=", "$", "this", "->", "cronCollection", "->", "create", "(", ")", "->", "addFieldToFilter", "(", "'job_code'", ",", "$", "jobCode", ")", "->", "addFieldTo...
Check if already ran for same time @param string $jobCode @return bool
[ "Check", "if", "already", "ran", "for", "same", "time" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L359-L376
train
dotmailer/dotmailer-magento2-extension
Model/Cron.php
Cron.syncEmailTemplates
public function syncEmailTemplates() { if ($this->jobHasAlreadyBeenRun('ddg_automation_email_templates')) { $message = 'Skipping ddg_automation_email_templates job run'; $this->helper->log($message); return $message; } return $this->templateFactory->create() ->sync(); }
php
public function syncEmailTemplates() { if ($this->jobHasAlreadyBeenRun('ddg_automation_email_templates')) { $message = 'Skipping ddg_automation_email_templates job run'; $this->helper->log($message); return $message; } return $this->templateFactory->create() ->sync(); }
[ "public", "function", "syncEmailTemplates", "(", ")", "{", "if", "(", "$", "this", "->", "jobHasAlreadyBeenRun", "(", "'ddg_automation_email_templates'", ")", ")", "{", "$", "message", "=", "'Skipping ddg_automation_email_templates job run'", ";", "$", "this", "->", ...
Sync the email templates from dotmailer.
[ "Sync", "the", "email", "templates", "from", "dotmailer", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Cron.php#L381-L391
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.setContactData
public function setContactData($customer) { $this->model = $customer; $this->setReviewCollection(); parent::setContactData($customer); return $this; }
php
public function setContactData($customer) { $this->model = $customer; $this->setReviewCollection(); parent::setContactData($customer); return $this; }
[ "public", "function", "setContactData", "(", "$", "customer", ")", "{", "$", "this", "->", "model", "=", "$", "customer", ";", "$", "this", "->", "setReviewCollection", "(", ")", ";", "parent", "::", "setContactData", "(", "$", "customer", ")", ";", "ret...
Set customer data. @param \Magento\Customer\Model\Customer customer @return $this
[ "Set", "customer", "data", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L142-L149
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.setReviewCollection
public function setReviewCollection() { $customerId = $this->model->getId(); $collection = $this->reviewCollection->create() ->addCustomerFilter($customerId) ->setOrder('review_id', 'DESC'); $this->reviewCollection = $collection; return $this; }
php
public function setReviewCollection() { $customerId = $this->model->getId(); $collection = $this->reviewCollection->create() ->addCustomerFilter($customerId) ->setOrder('review_id', 'DESC'); $this->reviewCollection = $collection; return $this; }
[ "public", "function", "setReviewCollection", "(", ")", "{", "$", "customerId", "=", "$", "this", "->", "model", "->", "getId", "(", ")", ";", "$", "collection", "=", "$", "this", "->", "reviewCollection", "->", "create", "(", ")", "->", "addCustomerFilter"...
Customer reviews. @return $this
[ "Customer", "reviews", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L176-L186
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.getLastReviewDate
public function getLastReviewDate() { if ($this->reviewCollection->getSize()) { $this->reviewCollection->getSelect()->limit(1); $createdAt = $this->reviewCollection ->getFirstItem() ->getCreatedAt(); return $createdAt; } return ''; }
php
public function getLastReviewDate() { if ($this->reviewCollection->getSize()) { $this->reviewCollection->getSelect()->limit(1); $createdAt = $this->reviewCollection ->getFirstItem() ->getCreatedAt(); return $createdAt; } return ''; }
[ "public", "function", "getLastReviewDate", "(", ")", "{", "if", "(", "$", "this", "->", "reviewCollection", "->", "getSize", "(", ")", ")", "{", "$", "this", "->", "reviewCollection", "->", "getSelect", "(", ")", "->", "limit", "(", "1", ")", ";", "$",...
Last review date. @return string
[ "Last", "review", "date", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L203-L214
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.getTotalRefund
public function getTotalRefund() { //filter by customer id $customerOrders = $this->orderCollection->create() ->addAttributeToFilter('customer_id', $this->model->getId()); $totalRefunded = 0; //calculate total refunded foreach ($customerOrders as $order) { $refunded = $order->getTotalRefunded(); $totalRefunded += $refunded; } return $totalRefunded; }
php
public function getTotalRefund() { //filter by customer id $customerOrders = $this->orderCollection->create() ->addAttributeToFilter('customer_id', $this->model->getId()); $totalRefunded = 0; //calculate total refunded foreach ($customerOrders as $order) { $refunded = $order->getTotalRefunded(); $totalRefunded += $refunded; } return $totalRefunded; }
[ "public", "function", "getTotalRefund", "(", ")", "{", "//filter by customer id", "$", "customerOrders", "=", "$", "this", "->", "orderCollection", "->", "create", "(", ")", "->", "addAttributeToFilter", "(", "'customer_id'", ",", "$", "this", "->", "model", "->...
Total value refunded for the customer. @return float|int
[ "Total", "value", "refunded", "for", "the", "customer", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L471-L485
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.getCustomerGender
public function getCustomerGender() { $genderId = $this->model->getGender(); if (is_numeric($genderId)) { $gender = $this->model->getAttribute('gender') ->getSource()->getOptionText($genderId); return $gender; } return ''; }
php
public function getCustomerGender() { $genderId = $this->model->getGender(); if (is_numeric($genderId)) { $gender = $this->model->getAttribute('gender') ->getSource()->getOptionText($genderId); return $gender; } return ''; }
[ "public", "function", "getCustomerGender", "(", ")", "{", "$", "genderId", "=", "$", "this", "->", "model", "->", "getGender", "(", ")", ";", "if", "(", "is_numeric", "(", "$", "genderId", ")", ")", "{", "$", "gender", "=", "$", "this", "->", "model"...
customer gender. @return bool|string
[ "customer", "gender", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L492-L503
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Customer.php
Customer.getSubscriberStatus
public function getSubscriberStatus() { $subscriberModel = $this->subscriberFactory->create() ->loadByCustomerId($this->model->getId()); if ($subscriberModel->getCustomerId()) { return $this->subscriberStatus[$subscriberModel->getSubscriberStatus()]; } return false; }
php
public function getSubscriberStatus() { $subscriberModel = $this->subscriberFactory->create() ->loadByCustomerId($this->model->getId()); if ($subscriberModel->getCustomerId()) { return $this->subscriberStatus[$subscriberModel->getSubscriberStatus()]; } return false; }
[ "public", "function", "getSubscriberStatus", "(", ")", "{", "$", "subscriberModel", "=", "$", "this", "->", "subscriberFactory", "->", "create", "(", ")", "->", "loadByCustomerId", "(", "$", "this", "->", "model", "->", "getId", "(", ")", ")", ";", "if", ...
Subscriber status for Customer. @return boolean|string
[ "Subscriber", "status", "for", "Customer", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Customer.php#L540-L550
train
dotmailer/dotmailer-magento2-extension
Model/AbandonedCart/CartInsight/Data.php
Data.getPayload
private function getPayload($quote, $store) { $data = [ 'key' => $quote->getId(), 'contactIdentifier' => $quote->getCustomerEmail(), 'json' => [ 'cartId' => $quote->getId(), 'cartUrl' => $this->getBasketUrl($quote->getId(), $store), 'createdDate' => $this->dateTime->date(\Zend_Date::ISO_8601, $quote->getCreatedAt()), 'modifiedDate' => $this->dateTime->date(\Zend_Date::ISO_8601, $quote->getUpdatedAt()), 'currency' => $quote->getQuoteCurrencyCode(), 'subTotal' => round($quote->getSubtotal(), 2), 'taxAmount' => round($quote->getShippingAddress()->getTaxAmount(), 2), 'grandTotal' => round($quote->getGrandTotal(), 2) ] ]; $discountTotal = 0; $lineItems = []; foreach ($quote->getAllVisibleItems() as $item) { $discountTotal += $item->getDiscountAmount(); $product = $this->productRepository->getById($item->getProduct()->getId(), false, $store->getId()); $lineItems[] = [ 'sku' => $item->getSku(), 'imageUrl' => $this->getProductImageUrl($item, $store), 'productUrl' => $this->urlFinder->fetchFor($product), 'name' => $item->getName(), 'unitPrice' => round($item->getPrice(), 2), 'quantity' => $item->getQty() ]; } $data['json']['discountAmount'] = (float) $discountTotal; $data['json']['lineItems'] = $lineItems; return $data; }
php
private function getPayload($quote, $store) { $data = [ 'key' => $quote->getId(), 'contactIdentifier' => $quote->getCustomerEmail(), 'json' => [ 'cartId' => $quote->getId(), 'cartUrl' => $this->getBasketUrl($quote->getId(), $store), 'createdDate' => $this->dateTime->date(\Zend_Date::ISO_8601, $quote->getCreatedAt()), 'modifiedDate' => $this->dateTime->date(\Zend_Date::ISO_8601, $quote->getUpdatedAt()), 'currency' => $quote->getQuoteCurrencyCode(), 'subTotal' => round($quote->getSubtotal(), 2), 'taxAmount' => round($quote->getShippingAddress()->getTaxAmount(), 2), 'grandTotal' => round($quote->getGrandTotal(), 2) ] ]; $discountTotal = 0; $lineItems = []; foreach ($quote->getAllVisibleItems() as $item) { $discountTotal += $item->getDiscountAmount(); $product = $this->productRepository->getById($item->getProduct()->getId(), false, $store->getId()); $lineItems[] = [ 'sku' => $item->getSku(), 'imageUrl' => $this->getProductImageUrl($item, $store), 'productUrl' => $this->urlFinder->fetchFor($product), 'name' => $item->getName(), 'unitPrice' => round($item->getPrice(), 2), 'quantity' => $item->getQty() ]; } $data['json']['discountAmount'] = (float) $discountTotal; $data['json']['lineItems'] = $lineItems; return $data; }
[ "private", "function", "getPayload", "(", "$", "quote", ",", "$", "store", ")", "{", "$", "data", "=", "[", "'key'", "=>", "$", "quote", "->", "getId", "(", ")", ",", "'contactIdentifier'", "=>", "$", "quote", "->", "getCustomerEmail", "(", ")", ",", ...
Get payload data for API push. @param \Magento\Quote\Model\Quote $quote @param \Magento\Store\Api\Data\StoreInterface $store @return array @throws \Magento\Framework\Exception\NoSuchEntityException
[ "Get", "payload", "data", "for", "API", "push", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/AbandonedCart/CartInsight/Data.php#L93-L132
train
dotmailer/dotmailer-magento2-extension
Model/AbandonedCart/CartInsight/Data.php
Data.getProductImageUrl
private function getProductImageUrl($item, $store) { $url = ""; $base = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true) . 'catalog/product'; $configurableProductImage = $this->scopeConfig->getValue( 'checkout/cart/configurable_product_image', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId() ); if ($configurableProductImage === "itself") { // Use item SKU to retrieve properties of configurable products $id = $item->getProduct()->getIdBySku($item->getSku()); $product = $this->productRepository->getById($id); if ($product->getThumbnail() !== "no_selection") { return $base . $product->getThumbnail(); } } // Parent thumbnail if ($item->getProduct()->getThumbnail() !== "no_selection") { $url = $base . $item->getProduct()->getThumbnail(); } return $url; }
php
private function getProductImageUrl($item, $store) { $url = ""; $base = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true) . 'catalog/product'; $configurableProductImage = $this->scopeConfig->getValue( 'checkout/cart/configurable_product_image', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId() ); if ($configurableProductImage === "itself") { // Use item SKU to retrieve properties of configurable products $id = $item->getProduct()->getIdBySku($item->getSku()); $product = $this->productRepository->getById($id); if ($product->getThumbnail() !== "no_selection") { return $base . $product->getThumbnail(); } } // Parent thumbnail if ($item->getProduct()->getThumbnail() !== "no_selection") { $url = $base . $item->getProduct()->getThumbnail(); } return $url; }
[ "private", "function", "getProductImageUrl", "(", "$", "item", ",", "$", "store", ")", "{", "$", "url", "=", "\"\"", ";", "$", "base", "=", "$", "store", "->", "getBaseUrl", "(", "\\", "Magento", "\\", "Framework", "\\", "UrlInterface", "::", "URL_TYPE_M...
Get product image URL. We respect the "Configurable Product Image" setting in determining which image to retrieve. @param \Magento\Quote\Model\Quote\Item $item @param \Magento\Store\Api\Data\StoreInterface $store @return string @throws \Magento\Framework\Exception\NoSuchEntityException
[ "Get", "product", "image", "URL", ".", "We", "respect", "the", "Configurable", "Product", "Image", "setting", "in", "determining", "which", "image", "to", "retrieve", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/AbandonedCart/CartInsight/Data.php#L160-L188
train
dotmailer/dotmailer-magento2-extension
Block/Feefo.php
Feefo.getServiceScoreLogo
public function getServiceScoreLogo() { $params = $this->getRequest()->getParams(); if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Feefo no valid code is set'); return []; } $url = 'http://www.feefo.com/feefo/feefologo.jsp?logon='; $logon = $this->helper->getFeefoLogon(); $template = ''; if ($this->helper->getFeefoLogoTemplate()) { $template = '&template=' . $this->helper->getFeefoLogoTemplate(); } $fullUrl = $url . $logon . $template; $vendorUrl = 'http://www.feefo.com/feefo/viewvendor.jsp?logon=' . $logon; return ['vendorUrl' => $vendorUrl, 'fullUrl' => $fullUrl]; }
php
public function getServiceScoreLogo() { $params = $this->getRequest()->getParams(); if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Feefo no valid code is set'); return []; } $url = 'http://www.feefo.com/feefo/feefologo.jsp?logon='; $logon = $this->helper->getFeefoLogon(); $template = ''; if ($this->helper->getFeefoLogoTemplate()) { $template = '&template=' . $this->helper->getFeefoLogoTemplate(); } $fullUrl = $url . $logon . $template; $vendorUrl = 'http://www.feefo.com/feefo/viewvendor.jsp?logon=' . $logon; return ['vendorUrl' => $vendorUrl, 'fullUrl' => $fullUrl]; }
[ "public", "function", "getServiceScoreLogo", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getParams", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "params", "[", "'code'", "]", ")", "||", "!", "$", "this...
Get customer's service score logo and output it. @return array
[ "Get", "customer", "s", "service", "score", "logo", "and", "output", "it", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Feefo.php#L98-L117
train
dotmailer/dotmailer-magento2-extension
Block/Feefo.php
Feefo.getQuoteProducts
private function getQuoteProducts() { $products = []; $params = $this->_request->getParams(); if (! isset($params['quote_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Feefo no quote id or code is set'); return $products; } $quoteId = (int) $params['quote_id']; $quoteModel = $this->quoteFactory->create(); $this->quoteResource->load($quoteModel, $quoteId); if (! $quoteModel->getId()) { return $products; } $productCollection = $this->review->getProductCollection($quoteModel); foreach ($productCollection as $product) { $products[$product->getSku()] = $product->getName(); } return $products; }
php
private function getQuoteProducts() { $products = []; $params = $this->_request->getParams(); if (! isset($params['quote_id']) || ! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) { $this->helper->log('Feefo no quote id or code is set'); return $products; } $quoteId = (int) $params['quote_id']; $quoteModel = $this->quoteFactory->create(); $this->quoteResource->load($quoteModel, $quoteId); if (! $quoteModel->getId()) { return $products; } $productCollection = $this->review->getProductCollection($quoteModel); foreach ($productCollection as $product) { $products[$product->getSku()] = $product->getName(); } return $products; }
[ "private", "function", "getQuoteProducts", "(", ")", "{", "$", "products", "=", "[", "]", ";", "$", "params", "=", "$", "this", "->", "_request", "->", "getParams", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "params", "[", "'quote_id'", "]", ...
Get quote products to show feefo reviews. @return array
[ "Get", "quote", "products", "to", "show", "feefo", "reviews", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Feefo.php#L124-L150
train
dotmailer/dotmailer-magento2-extension
Block/Feefo.php
Feefo.getProductsReview
public function getProductsReview($check = true) { $reviews = []; $logon = $this->helper->getFeefoLogon(); $limit = $this->helper->getFeefoReviewsPerProduct(); $products = $this->getQuoteProducts(); foreach ($products as $sku => $name) { $url = 'http://www.feefo.com/feefo/xmlfeed.jsp?logon=' . $logon . '&limit=' . $limit . '&vendorref=' . $sku . '&mode=productonly'; $doc = $this->domDocument; $xsl = $this->processor; if ($check) { $pathToTemplate = $this->getFeefoTemplate('feedback.xsl'); $doc->load($pathToTemplate); } else { $pathToTemplate = $this->getFeefoTemplate('feedback-no-th.xsl'); $doc->load($pathToTemplate); } $xsl->importStyleSheet($doc); $doc->loadXML(file_get_contents($url)); $productReview = $xsl->transformToXML($doc); if (strpos($productReview, '<td') !== false) { $reviews[$name] = $xsl->transformToXML($doc); } $check = false; } return $reviews; }
php
public function getProductsReview($check = true) { $reviews = []; $logon = $this->helper->getFeefoLogon(); $limit = $this->helper->getFeefoReviewsPerProduct(); $products = $this->getQuoteProducts(); foreach ($products as $sku => $name) { $url = 'http://www.feefo.com/feefo/xmlfeed.jsp?logon=' . $logon . '&limit=' . $limit . '&vendorref=' . $sku . '&mode=productonly'; $doc = $this->domDocument; $xsl = $this->processor; if ($check) { $pathToTemplate = $this->getFeefoTemplate('feedback.xsl'); $doc->load($pathToTemplate); } else { $pathToTemplate = $this->getFeefoTemplate('feedback-no-th.xsl'); $doc->load($pathToTemplate); } $xsl->importStyleSheet($doc); $doc->loadXML(file_get_contents($url)); $productReview = $xsl->transformToXML($doc); if (strpos($productReview, '<td') !== false) { $reviews[$name] = $xsl->transformToXML($doc); } $check = false; } return $reviews; }
[ "public", "function", "getProductsReview", "(", "$", "check", "=", "true", ")", "{", "$", "reviews", "=", "[", "]", ";", "$", "logon", "=", "$", "this", "->", "helper", "->", "getFeefoLogon", "(", ")", ";", "$", "limit", "=", "$", "this", "->", "he...
Get product reviews from feefo. @param bool $check @return array
[ "Get", "product", "reviews", "from", "feefo", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Feefo.php#L159-L189
train
dotmailer/dotmailer-magento2-extension
Plugin/MessagePlugin.php
MessagePlugin.createMimeFromString
private function createMimeFromString($body) { $bodyPart = new Part($body); $bodyPart->setEncoding(Mime::ENCODING_QUOTEDPRINTABLE); $bodyPart->setCharset(SmtpTransportZend2::ENCODING); ($this->isHTML($body)) ? $bodyPart->setType(Mime::TYPE_HTML) : $bodyPart->setType(Mime::TYPE_TEXT); $mimeMessage = new \Zend\Mime\Message(); $mimeMessage->addPart($bodyPart); return $mimeMessage; }
php
private function createMimeFromString($body) { $bodyPart = new Part($body); $bodyPart->setEncoding(Mime::ENCODING_QUOTEDPRINTABLE); $bodyPart->setCharset(SmtpTransportZend2::ENCODING); ($this->isHTML($body)) ? $bodyPart->setType(Mime::TYPE_HTML) : $bodyPart->setType(Mime::TYPE_TEXT); $mimeMessage = new \Zend\Mime\Message(); $mimeMessage->addPart($bodyPart); return $mimeMessage; }
[ "private", "function", "createMimeFromString", "(", "$", "body", ")", "{", "$", "bodyPart", "=", "new", "Part", "(", "$", "body", ")", ";", "$", "bodyPart", "->", "setEncoding", "(", "Mime", "::", "ENCODING_QUOTEDPRINTABLE", ")", ";", "$", "bodyPart", "->"...
Create HTML mime message from the string. @param string $body @return \Zend\Mime\Message
[ "Create", "HTML", "mime", "message", "from", "the", "string", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Plugin/MessagePlugin.php#L92-L101
train
dotmailer/dotmailer-magento2-extension
Model/Customer/Review.php
Review.setReviewData
public function setReviewData(\Magento\Review\Model\Review $review) { $store = $this->storeManager->getStore($review->getStoreId()); $websiteName = $store->getWebsite()->getName(); $storeName = $store->getName(); $this->setId($review->getReviewId()) ->setWebsiteName($websiteName) ->setStoreName($storeName) ->setReviewDate($review->getCreatedAt()) ->setCustomerId($review->getCustomerId()) ->setEmail($review->getEmail()); return $this; }
php
public function setReviewData(\Magento\Review\Model\Review $review) { $store = $this->storeManager->getStore($review->getStoreId()); $websiteName = $store->getWebsite()->getName(); $storeName = $store->getName(); $this->setId($review->getReviewId()) ->setWebsiteName($websiteName) ->setStoreName($storeName) ->setReviewDate($review->getCreatedAt()) ->setCustomerId($review->getCustomerId()) ->setEmail($review->getEmail()); return $this; }
[ "public", "function", "setReviewData", "(", "\\", "Magento", "\\", "Review", "\\", "Model", "\\", "Review", "$", "review", ")", "{", "$", "store", "=", "$", "this", "->", "storeManager", "->", "getStore", "(", "$", "review", "->", "getStoreId", "(", ")",...
Set review data. @param \Magento\Review\Model\Review $review @return $this
[ "Set", "review", "data", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Customer/Review.php#L182-L195
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.validate
public function validate($apiUsername, $apiPassword) { if ($apiUsername && $apiPassword) { $this->setApiUsername($apiUsername) ->setApiPassword($apiPassword); $accountInfo = $this->getAccountInfo(); if (isset($accountInfo->message)) { $message = 'VALIDATION ERROR : ' . $accountInfo->message; $this->helper->debug('validate', [$message]); return false; } return $accountInfo; } return false; }
php
public function validate($apiUsername, $apiPassword) { if ($apiUsername && $apiPassword) { $this->setApiUsername($apiUsername) ->setApiPassword($apiPassword); $accountInfo = $this->getAccountInfo(); if (isset($accountInfo->message)) { $message = 'VALIDATION ERROR : ' . $accountInfo->message; $this->helper->debug('validate', [$message]); return false; } return $accountInfo; } return false; }
[ "public", "function", "validate", "(", "$", "apiUsername", ",", "$", "apiPassword", ")", "{", "if", "(", "$", "apiUsername", "&&", "$", "apiPassword", ")", "{", "$", "this", "->", "setApiUsername", "(", "$", "apiUsername", ")", "->", "setApiPassword", "(",...
Api validation. @param string $apiUsername @param string $apiPassword @return bool|mixed
[ "Api", "validation", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L134-L152
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactById
public function getContactById($id) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $id; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACT INFO ID ' . $url . ', ' . $response->message; $this->helper->debug('getContactById', [$message]); } return $response; }
php
public function getContactById($id) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $id; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACT INFO ID ' . $url . ', ' . $response->message; $this->helper->debug('getContactById', [$message]); } return $response; }
[ "public", "function", "getContactById", "(", "$", "id", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS", ".", "$", "id", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "set...
Gets a contact by ID. Unsubscribed or suppressed contacts will not be retrieved. @param string $id @return null @throws \Exception
[ "Gets", "a", "contact", "by", "ID", ".", "Unsubscribed", "or", "suppressed", "contacts", "will", "not", "be", "retrieved", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L162-L176
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postAddressBookContactsImport
public function postAddressBookContactsImport($filename, $addressBookId) { $url = $this->getApiEndpoint() . "/v2/address-books/{$addressBookId}/contacts/import"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt( $ch, CURLOPT_USERPWD, $this->getApiUsername() . ':' . $this->getApiPassword() ); //case the deprication of @filename for uploading if (function_exists('curl_file_create')) { $args['file'] = curl_file_create( $this->fileHelper->getFilePathWithFallback($filename), 'text/csv' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $args); } else { //standart use of curl file curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'file' => '@' . $this->fileHelper->getFilePathWithFallback($filename), ]); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: multipart/form-data', ]); // send contacts to address book $result = curl_exec($ch); $result = json_decode($result); if (isset($result->message)) { $message = 'postAddressBookContactsImport' . $addressBookId . ' file : ' . $filename . ' ,user : ' . $this->getApiUsername() . '. ' . $result->message; $this->helper->debug('postAddressBookContactsImport', [$message]); } return $result; }
php
public function postAddressBookContactsImport($filename, $addressBookId) { $url = $this->getApiEndpoint() . "/v2/address-books/{$addressBookId}/contacts/import"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt( $ch, CURLOPT_USERPWD, $this->getApiUsername() . ':' . $this->getApiPassword() ); //case the deprication of @filename for uploading if (function_exists('curl_file_create')) { $args['file'] = curl_file_create( $this->fileHelper->getFilePathWithFallback($filename), 'text/csv' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $args); } else { //standart use of curl file curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'file' => '@' . $this->fileHelper->getFilePathWithFallback($filename), ]); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: multipart/form-data', ]); // send contacts to address book $result = curl_exec($ch); $result = json_decode($result); if (isset($result->message)) { $message = 'postAddressBookContactsImport' . $addressBookId . ' file : ' . $filename . ' ,user : ' . $this->getApiUsername() . '. ' . $result->message; $this->helper->debug('postAddressBookContactsImport', [$message]); } return $result; }
[ "public", "function", "postAddressBookContactsImport", "(", "$", "filename", ",", "$", "addressBookId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "\"/v2/address-books/{$addressBookId}/contacts/import\"", ";", "$", "ch", "=", "c...
Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel. Must include one column called "Email". Any other columns will attempt to map to your custom data fields. The ID of returned object can be used to query import progress. @param string|int $filename @param string|int $addressBookId @return mixed
[ "Bulk", "creates", "or", "bulk", "updates", "contacts", ".", "Import", "format", "can", "either", "be", "CSV", "or", "Excel", ".", "Must", "include", "one", "column", "called", "Email", ".", "Any", "other", "columns", "will", "attempt", "to", "map", "to", ...
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L188-L231
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postAddressBookContacts
public function postAddressBookContacts($addressBookId, $apiContact) { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts'; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($apiContact); $response = $this->execute(); if (isset($response->message)) { $message = 'POST ADDRESS BOOK CONTACTS ' . $url . ', ' . $response->message; $this->helper->debug('postAddressBookContacts', [$message]); } return $response; }
php
public function postAddressBookContacts($addressBookId, $apiContact) { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts'; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($apiContact); $response = $this->execute(); if (isset($response->message)) { $message = 'POST ADDRESS BOOK CONTACTS ' . $url . ', ' . $response->message; $this->helper->debug('postAddressBookContacts', [$message]); } return $response; }
[ "public", "function", "postAddressBookContacts", "(", "$", "addressBookId", ",", "$", "apiContact", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_ADDRESS_BOOKS", ".", "$", "addressBookId", ".", "'/contacts'"...
Adds a contact to a given address book. @param string|int $addressBookId @param string|int $apiContact @return mixed|null
[ "Adds", "a", "contact", "to", "a", "given", "address", "book", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L241-L258
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.deleteAddressBookContact
public function deleteAddressBookContact($addressBookId, $contactId) { //Only if there is a contact id and address book id if ($addressBookId && $contactId) { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts/' . $contactId; $this->setUrl($url) ->setVerb('DELETE'); $this->execute(); $this->helper->log(sprintf('Delete-contact %s from addressbook %s', $contactId, $addressBookId)); } }
php
public function deleteAddressBookContact($addressBookId, $contactId) { //Only if there is a contact id and address book id if ($addressBookId && $contactId) { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts/' . $contactId; $this->setUrl($url) ->setVerb('DELETE'); $this->execute(); $this->helper->log(sprintf('Delete-contact %s from addressbook %s', $contactId, $addressBookId)); } }
[ "public", "function", "deleteAddressBookContact", "(", "$", "addressBookId", ",", "$", "contactId", ")", "{", "//Only if there is a contact id and address book id", "if", "(", "$", "addressBookId", "&&", "$", "contactId", ")", "{", "$", "url", "=", "$", "this", "-...
Deletes all contacts from a given address book. @param string|int $addressBookId @param string|int $contactId @return null
[ "Deletes", "all", "contacts", "from", "a", "given", "address", "book", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L286-L297
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactsImportReport
public function getContactsImportReport($importId) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_IMPORT . $importId . '/report'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS IMPORT REPORT . ' . $url . ' message : ' . $response->message; $this->helper->debug('getContactsImportReport', [$message]); } return $response; }
php
public function getContactsImportReport($importId) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_IMPORT . $importId . '/report'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS IMPORT REPORT . ' . $url . ' message : ' . $response->message; $this->helper->debug('getContactsImportReport', [$message]); } return $response; }
[ "public", "function", "getContactsImportReport", "(", "$", "importId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS_IMPORT", ".", "$", "importId", ".", "'/report'", ";", "$", "this", "->", "set...
Gets a report with statistics about what was successfully imported, and what was unable to be imported. @param string|int $importId @return mixed
[ "Gets", "a", "report", "with", "statistics", "about", "what", "was", "successfully", "imported", "and", "what", "was", "unable", "to", "be", "imported", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L306-L322
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactByEmail
public function getContactByEmail($email) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $email; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACT BY email : ' . $email . ' ' . $response->message; $this->helper->debug('getContactByEmail', [$message]); } return $response; }
php
public function getContactByEmail($email) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $email; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACT BY email : ' . $email . ' ' . $response->message; $this->helper->debug('getContactByEmail', [$message]); } return $response; }
[ "public", "function", "getContactByEmail", "(", "$", "email", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS", ".", "$", "email", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->...
Gets a contact by email address. @param string $email @return mixed
[ "Gets", "a", "contact", "by", "email", "address", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L331-L346
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getAddressBooks
public function getAddressBooks() { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ALL ADDRESS BOOKS : ' . $url . ', ' . $response->message; $this->helper->debug('getAddressBooks', [$message]); } return $response; }
php
public function getAddressBooks() { $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ALL ADDRESS BOOKS : ' . $url . ', ' . $response->message; $this->helper->debug('getAddressBooks', [$message]); } return $response; }
[ "public", "function", "getAddressBooks", "(", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_ADDRESS_BOOKS", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", "'GET'", ")",...
Get all address books. @return mixed @throws \Exception
[ "Get", "all", "address", "books", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L355-L369
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postAddressBooks
public function postAddressBooks($name, $visibility = 'Public') { $data = [ 'Name' => $name, 'Visibility' => $visibility, ]; $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $this->helper->debug('postAddressBooks', $data); } return $response; }
php
public function postAddressBooks($name, $visibility = 'Public') { $data = [ 'Name' => $name, 'Visibility' => $visibility, ]; $url = $this->getApiEndpoint() . self::REST_ADDRESS_BOOKS; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $this->helper->debug('postAddressBooks', $data); } return $response; }
[ "public", "function", "postAddressBooks", "(", "$", "name", ",", "$", "visibility", "=", "'Public'", ")", "{", "$", "data", "=", "[", "'Name'", "=>", "$", "name", ",", "'Visibility'", "=>", "$", "visibility", ",", "]", ";", "$", "url", "=", "$", "thi...
Creates an address book. @param string $name @param string $visibility @return null @throws \Exception
[ "Creates", "an", "address", "book", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L404-L422
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getCampaigns
public function getCampaigns($skip = 0, $select = 1000) { $url = sprintf('%s%s?select=%s&skip=%s', $this->getApiEndpoint(), self::REST_DATA_FIELDS_CAMPAIGNS, $select, $skip ); $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CAMPAIGNS ' . $response->message . ' api user : ' . $this->getApiUsername(); $this->helper->debug('getCampaigns', [$message]); } return $response; }
php
public function getCampaigns($skip = 0, $select = 1000) { $url = sprintf('%s%s?select=%s&skip=%s', $this->getApiEndpoint(), self::REST_DATA_FIELDS_CAMPAIGNS, $select, $skip ); $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CAMPAIGNS ' . $response->message . ' api user : ' . $this->getApiUsername(); $this->helper->debug('getCampaigns', [$message]); } return $response; }
[ "public", "function", "getCampaigns", "(", "$", "skip", "=", "0", ",", "$", "select", "=", "1000", ")", "{", "$", "url", "=", "sprintf", "(", "'%s%s?select=%s&skip=%s'", ",", "$", "this", "->", "getApiEndpoint", "(", ")", ",", "self", "::", "REST_DATA_FI...
Get list of all campaigns. @param int $skip Number of campaigns to skip @param int $select Number of campaigns to select @return mixed @throws \Exception
[ "Get", "list", "of", "all", "campaigns", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L433-L453
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postDataFields
public function postDataFields( $data, $type = 'String', $visibility = 'public', $defaultValue = false ) { $url = $this->getApiEndpoint() . self::REST_DATA_FILEDS; //set default value for the numeric datatype if ($type == 'numeric' && !$defaultValue) { $defaultValue = 0; } //set data for the string datatype if (is_string($data)) { $data = [ 'Name' => $data, 'Type' => $type, 'Visibility' => $visibility, ]; //default value if ($defaultValue) { $data['DefaultValue'] = $defaultValue; } } $this->setUrl($url) ->buildPostBody($data) ->setVerb('POST'); $response = $this->execute(); if (isset($response->message)) { $message = 'POST CREATE DATAFIELDS ' . $response->message; $this->helper->debug('postDataFields', [$message]); $this->helper->debug('postDataFields', $data); } return $response; }
php
public function postDataFields( $data, $type = 'String', $visibility = 'public', $defaultValue = false ) { $url = $this->getApiEndpoint() . self::REST_DATA_FILEDS; //set default value for the numeric datatype if ($type == 'numeric' && !$defaultValue) { $defaultValue = 0; } //set data for the string datatype if (is_string($data)) { $data = [ 'Name' => $data, 'Type' => $type, 'Visibility' => $visibility, ]; //default value if ($defaultValue) { $data['DefaultValue'] = $defaultValue; } } $this->setUrl($url) ->buildPostBody($data) ->setVerb('POST'); $response = $this->execute(); if (isset($response->message)) { $message = 'POST CREATE DATAFIELDS ' . $response->message; $this->helper->debug('postDataFields', [$message]); $this->helper->debug('postDataFields', $data); } return $response; }
[ "public", "function", "postDataFields", "(", "$", "data", ",", "$", "type", "=", "'String'", ",", "$", "visibility", "=", "'public'", ",", "$", "defaultValue", "=", "false", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".",...
Creates a data field within the account. @param $data string/array @param string $type string, numeric, date, boolean @param string $visibility public, private @param bool $defaultValue @return object
[ "Creates", "a", "data", "field", "within", "the", "account", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L508-L544
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getDataFields
public function getDataFields() { $url = $this->getApiEndpoint() . self::REST_DATA_FILEDS; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ALL DATAFIELDS ' . $response->message; $this->helper->debug('getDataFields', [$message]); } return $response; }
php
public function getDataFields() { $url = $this->getApiEndpoint() . self::REST_DATA_FILEDS; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ALL DATAFIELDS ' . $response->message; $this->helper->debug('getDataFields', [$message]); } return $response; }
[ "public", "function", "getDataFields", "(", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_DATA_FILEDS", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", "'GET'", ")", "...
Lists the data fields within the account. @return mixed
[ "Lists", "the", "data", "fields", "within", "the", "account", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L551-L564
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.updateContact
public function updateContact($contactId, $data) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'ERROR : UPDATE SINGLE CONTACT : ' . $url . ' message : ' . $response->message; $this->helper->debug('updateContact', [$message]); $this->helper->debug('updateContact', $data); } return $response; }
php
public function updateContact($contactId, $data) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'ERROR : UPDATE SINGLE CONTACT : ' . $url . ' message : ' . $response->message; $this->helper->debug('updateContact', [$message]); $this->helper->debug('updateContact', $data); } return $response; }
[ "public", "function", "updateContact", "(", "$", "contactId", ",", "$", "data", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS", ".", "$", "contactId", ";", "$", "this", "->", "setUrl", "(", ...
Updates a contact. @param string|int $contactId @param array $data @return object
[ "Updates", "a", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L574-L590
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.deleteContact
public function deleteContact($contactId) { if ($contactId) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('DELETE'); $response = $this->execute(); if (isset($response->message)) { $message = ' url : ' . $url . ', ' . $response->message; $this->helper->debug('deleteContact', [$message]); } return $response; } }
php
public function deleteContact($contactId) { if ($contactId) { $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('DELETE'); $response = $this->execute(); if (isset($response->message)) { $message = ' url : ' . $url . ', ' . $response->message; $this->helper->debug('deleteContact', [$message]); } return $response; } }
[ "public", "function", "deleteContact", "(", "$", "contactId", ")", "{", "if", "(", "$", "contactId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS", ".", "$", "contactId", ";", "$", "this", ...
Deletes a contact. @param int $contactId @return null @throws \Exception
[ "Deletes", "a", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L600-L616
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.updateContactDatafieldsByEmail
public function updateContactDatafieldsByEmail($email, $dataFields) { $apiContact = $this->postContacts($email); //do not create for non contact id set if (!isset($apiContact->id)) { return $apiContact; } else { //get the contact id for this email $contactId = $apiContact->id; } $data = [ 'Email' => $email, 'EmailType' => 'Html', ]; $data['DataFields'] = $dataFields; $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'ERROR: UPDATE CONTACT DATAFIELD ' . $url . ' message : ' . $response->message; $this->helper->debug('updateContactDatafieldsByEmail', [$message]); $this->helper->debug('updateContactDatafieldsByEmail', $data); } return $response; }
php
public function updateContactDatafieldsByEmail($email, $dataFields) { $apiContact = $this->postContacts($email); //do not create for non contact id set if (!isset($apiContact->id)) { return $apiContact; } else { //get the contact id for this email $contactId = $apiContact->id; } $data = [ 'Email' => $email, 'EmailType' => 'Html', ]; $data['DataFields'] = $dataFields; $url = $this->getApiEndpoint() . self::REST_CONTACTS . $contactId; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'ERROR: UPDATE CONTACT DATAFIELD ' . $url . ' message : ' . $response->message; $this->helper->debug('updateContactDatafieldsByEmail', [$message]); $this->helper->debug('updateContactDatafieldsByEmail', $data); } return $response; }
[ "public", "function", "updateContactDatafieldsByEmail", "(", "$", "email", ",", "$", "dataFields", ")", "{", "$", "apiContact", "=", "$", "this", "->", "postContacts", "(", "$", "email", ")", ";", "//do not create for non contact id set", "if", "(", "!", "isset"...
Update contact datafields by email. @param string $email @param array $dataFields @return mixed|null @throws \Exception
[ "Update", "contact", "datafields", "by", "email", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L628-L658
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postCampaignsSend
public function postCampaignsSend($campaignId, $contacts) { $data = [ 'username' => $this->getApiUsername(), 'password' => $this->getApiPassword(), 'campaignId' => $campaignId, 'ContactIds' => $contacts, ]; $this->setUrl($this->getApiEndpoint() . self::REST_CAMPAIGN_SEND) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { unset($data['password']); $message = 'SENDING CAMPAIGN ' . $response->message; $this->helper->debug('postCampaignsSend', [$message]); $this->helper->debug('postCampaignsSend', $data); } return $response; }
php
public function postCampaignsSend($campaignId, $contacts) { $data = [ 'username' => $this->getApiUsername(), 'password' => $this->getApiPassword(), 'campaignId' => $campaignId, 'ContactIds' => $contacts, ]; $this->setUrl($this->getApiEndpoint() . self::REST_CAMPAIGN_SEND) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { unset($data['password']); $message = 'SENDING CAMPAIGN ' . $response->message; $this->helper->debug('postCampaignsSend', [$message]); $this->helper->debug('postCampaignsSend', $data); } return $response; }
[ "public", "function", "postCampaignsSend", "(", "$", "campaignId", ",", "$", "contacts", ")", "{", "$", "data", "=", "[", "'username'", "=>", "$", "this", "->", "getApiUsername", "(", ")", ",", "'password'", "=>", "$", "this", "->", "getApiPassword", "(", ...
Sends a specified campaign to one or more address books, segments or contacts at a specified time. Leave the address book array empty to send to All Contacts. @param int $campaignId @param array $contacts @return mixed
[ "Sends", "a", "specified", "campaign", "to", "one", "or", "more", "address", "books", "segments", "or", "contacts", "at", "a", "specified", "time", ".", "Leave", "the", "address", "book", "array", "empty", "to", "send", "to", "All", "Contacts", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L669-L690
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postContacts
public function postContacts($email) { $url = $this->getApiEndpoint() . self::REST_CONTACTS; $data = [ 'Email' => $email, 'EmailType' => 'Html', ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = $email . ' , url ' . $url . ', ' . $response->message; $this->helper->debug('postContacts', [$message]); } return $response; }
php
public function postContacts($email) { $url = $this->getApiEndpoint() . self::REST_CONTACTS; $data = [ 'Email' => $email, 'EmailType' => 'Html', ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = $email . ' , url ' . $url . ', ' . $response->message; $this->helper->debug('postContacts', [$message]); } return $response; }
[ "public", "function", "postContacts", "(", "$", "email", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS", ";", "$", "data", "=", "[", "'Email'", "=>", "$", "email", ",", "'EmailType'", "=>", ...
Creates a contact. @param string $email @return null @throws \Exception
[ "Creates", "a", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L700-L719
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactsSuppressedSinceDate
public function getContactsSuppressedSinceDate( $dateString, $select = 1000, $skip = 0 ) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString . '?select=' . $select . '&skip=' . $skip; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS SUPPRESSED SINSE : ' . $dateString . ' select ' . $select . ' skip : ' . $skip . ' response : ' . $response->message; $this->helper->debug('getContactsSuppressedSinceDate', [$message]); } return $response; }
php
public function getContactsSuppressedSinceDate( $dateString, $select = 1000, $skip = 0 ) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString . '?select=' . $select . '&skip=' . $skip; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS SUPPRESSED SINSE : ' . $dateString . ' select ' . $select . ' skip : ' . $skip . ' response : ' . $response->message; $this->helper->debug('getContactsSuppressedSinceDate', [$message]); } return $response; }
[ "public", "function", "getContactsSuppressedSinceDate", "(", "$", "dateString", ",", "$", "select", "=", "1000", ",", "$", "skip", "=", "0", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS_SUPPRES...
Gets a list of suppressed contacts after a given date along with the reason for suppression. @param string $dateString @param int $select @param int $skip @return object
[ "Gets", "a", "list", "of", "suppressed", "contacts", "after", "a", "given", "date", "along", "with", "the", "reason", "for", "suppression", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L730-L750
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postContactsTransactionalData
public function postContactsTransactionalData( $data, $collectionName = 'Orders' ) { $order = $this->getContactsTransactionalDataByKey( $collectionName, $data['id'] ); if (!isset($order->key) || isset($order->message) && $order->message == self::API_ERROR_TRANS_NOT_EXISTS ) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $collectionName; } else { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $collectionName . '/' . $order->key; } $apiData = [ 'Key' => $data['id'], 'ContactIdentifier' => $data['email'], 'Json' => json_encode($data), ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($apiData); $response = $this->execute(); if (isset($response->message)) { $message = 'POST CONTACTS TRANSACTIONAL DATA ' . $response->message; $this->helper->debug('postContactsTransactionalData', [$message]); $this->helper->debug('postContactsTransactionalData', $apiData); } return $response; }
php
public function postContactsTransactionalData( $data, $collectionName = 'Orders' ) { $order = $this->getContactsTransactionalDataByKey( $collectionName, $data['id'] ); if (!isset($order->key) || isset($order->message) && $order->message == self::API_ERROR_TRANS_NOT_EXISTS ) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $collectionName; } else { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $collectionName . '/' . $order->key; } $apiData = [ 'Key' => $data['id'], 'ContactIdentifier' => $data['email'], 'Json' => json_encode($data), ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($apiData); $response = $this->execute(); if (isset($response->message)) { $message = 'POST CONTACTS TRANSACTIONAL DATA ' . $response->message; $this->helper->debug('postContactsTransactionalData', [$message]); $this->helper->debug('postContactsTransactionalData', $apiData); } return $response; }
[ "public", "function", "postContactsTransactionalData", "(", "$", "data", ",", "$", "collectionName", "=", "'Orders'", ")", "{", "$", "order", "=", "$", "this", "->", "getContactsTransactionalDataByKey", "(", "$", "collectionName", ",", "$", "data", "[", "'id'", ...
Adds a single piece of transactional data to a contact. @param array $data @param string $collectionName @return null @throws \Exception
[ "Adds", "a", "single", "piece", "of", "transactional", "data", "to", "a", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L800-L836
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactsTransactionalDataByKey
public function getContactsTransactionalDataByKey($name, $key) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $name . '/' . $key; $this->setUrl($url) ->setVerb('GET'); return $this->execute(); }
php
public function getContactsTransactionalDataByKey($name, $key) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA . $name . '/' . $key; $this->setUrl($url) ->setVerb('GET'); return $this->execute(); }
[ "public", "function", "getContactsTransactionalDataByKey", "(", "$", "name", ",", "$", "key", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_TRANSACTIONAL_DATA", ".", "$", "name", ".", "'/'", ".", "$", ...
Gets a piece of transactional data by key. @param string $name @param int $key @return null @throws \Exception
[ "Gets", "a", "piece", "of", "transactional", "data", "by", "key", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L894-L902
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.deleteContactTransactionalData
public function deleteContactTransactionalData( $email, $collectionName = 'Orders' ) { if ($email && $collectionName) { $url = $this->getApiEndpoint() . '/v2/contacts/' . $email . '/transactional-data/' . $collectionName; $this->setUrl($url) ->setVerb('DELETE'); return $this->execute(); } }
php
public function deleteContactTransactionalData( $email, $collectionName = 'Orders' ) { if ($email && $collectionName) { $url = $this->getApiEndpoint() . '/v2/contacts/' . $email . '/transactional-data/' . $collectionName; $this->setUrl($url) ->setVerb('DELETE'); return $this->execute(); } }
[ "public", "function", "deleteContactTransactionalData", "(", "$", "email", ",", "$", "collectionName", "=", "'Orders'", ")", "{", "if", "(", "$", "email", "&&", "$", "collectionName", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")"...
Deletes all transactional data for a contact. @param string $email @param string $collectionName @return null @throws \Exception
[ "Deletes", "all", "transactional", "data", "for", "a", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L913-L925
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getAccountInfo
public function getAccountInfo() { $url = self::REST_ACCOUNT_INFO; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ACCOUNT INFO for api user : ' . $this->getApiUsername() . ' ' . $response->message; $this->helper->debug('getAccountInfo', [$message]); } return $response; }
php
public function getAccountInfo() { $url = self::REST_ACCOUNT_INFO; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET ACCOUNT INFO for api user : ' . $this->getApiUsername() . ' ' . $response->message; $this->helper->debug('getAccountInfo', [$message]); } return $response; }
[ "public", "function", "getAccountInfo", "(", ")", "{", "$", "url", "=", "self", "::", "REST_ACCOUNT_INFO", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", "'GET'", ")", ";", "$", "response", "=", "$", "this", "->", "exec...
Gets a summary of information about the current status of the account. @return object @throws \Exception
[ "Gets", "a", "summary", "of", "information", "about", "the", "current", "status", "of", "the", "account", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L934-L948
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postContactsResubscribe
public function postContactsResubscribe($apiContact) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_RESUBSCRIBE; $data = [ 'UnsubscribedContact' => $apiContact, ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'Resubscribe : ' . $url . ', message :' . $response->message; $this->helper->debug('postContactsResubscribe', [$message]); $this->helper->debug('postContactsResubscriber', $data); } return $response; }
php
public function postContactsResubscribe($apiContact) { $url = $this->getApiEndpoint() . self::REST_CONTACTS_RESUBSCRIBE; $data = [ 'UnsubscribedContact' => $apiContact, ]; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'Resubscribe : ' . $url . ', message :' . $response->message; $this->helper->debug('postContactsResubscribe', [$message]); $this->helper->debug('postContactsResubscriber', $data); } return $response; }
[ "public", "function", "postContactsResubscribe", "(", "$", "apiContact", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS_RESUBSCRIBE", ";", "$", "data", "=", "[", "'UnsubscribedContact'", "=>", "$", ...
Resubscribes a previously unsubscribed contact. @param array $apiContact @return object @throws \Exception
[ "Resubscribes", "a", "previously", "unsubscribed", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L959-L978
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getCustomFromAddresses
public function getCustomFromAddresses() { $url = $this->getApiEndpoint() . self::REST_CAMPAIGN_FROM_ADDRESS_LIST; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CampaignFromAddressList ' . $response->message . ' api user : ' . $this->getApiUsername(); $this->helper->debug('getCustomFromAddresses', [$message]); } return $response; }
php
public function getCustomFromAddresses() { $url = $this->getApiEndpoint() . self::REST_CAMPAIGN_FROM_ADDRESS_LIST; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CampaignFromAddressList ' . $response->message . ' api user : ' . $this->getApiUsername(); $this->helper->debug('getCustomFromAddresses', [$message]); } return $response; }
[ "public", "function", "getCustomFromAddresses", "(", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CAMPAIGN_FROM_ADDRESS_LIST", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(...
Gets all custom from addresses which can be used in a campaign. @return object @throws \Exception
[ "Gets", "all", "custom", "from", "addresses", "which", "can", "be", "used", "in", "a", "campaign", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L987-L1002
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postCampaign
public function postCampaign($data) { $url = $this->getApiEndpoint() . self::REST_CREATE_CAMPAIGN; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = $response->message; $this->helper->debug('postCampaign', [$message]); } return $response; }
php
public function postCampaign($data) { $url = $this->getApiEndpoint() . self::REST_CREATE_CAMPAIGN; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = $response->message; $this->helper->debug('postCampaign', [$message]); } return $response; }
[ "public", "function", "postCampaign", "(", "$", "data", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CREATE_CAMPAIGN", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", ...
Creates a campaign. @param array $data @return null @throws \Exception
[ "Creates", "a", "campaign", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1012-L1027
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postProgramsEnrolments
public function postProgramsEnrolments($data) { $url = $this->getApiEndpoint() . self::REST_PROGRAM_ENROLMENTS; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'Post programs enrolments : ' . $response->message; $this->helper->debug('postProgramsEnrolments', [$message]); $this->helper->debug('postProgramsEnrolments', $data); } return $response; }
php
public function postProgramsEnrolments($data) { $url = $this->getApiEndpoint() . self::REST_PROGRAM_ENROLMENTS; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $response = $this->execute(); if (isset($response->message)) { $message = 'Post programs enrolments : ' . $response->message; $this->helper->debug('postProgramsEnrolments', [$message]); $this->helper->debug('postProgramsEnrolments', $data); } return $response; }
[ "public", "function", "postProgramsEnrolments", "(", "$", "data", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_PROGRAM_ENROLMENTS", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVe...
Creates an enrolment. @param array $data @return null @throws \Exception
[ "Creates", "an", "enrolment", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1061-L1077
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getCampaignSummary
public function getCampaignSummary($campaignId) { $url = $this->getApiEndpoint() . '/v2/campaigns/' . $campaignId . '/summary'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'Get Campaign Summary ' . $response->message . ' ,url : ' . $url; $this->helper->debug('title', [$message]); } return $response; }
php
public function getCampaignSummary($campaignId) { $url = $this->getApiEndpoint() . '/v2/campaigns/' . $campaignId . '/summary'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'Get Campaign Summary ' . $response->message . ' ,url : ' . $url; $this->helper->debug('title', [$message]); } return $response; }
[ "public", "function", "getCampaignSummary", "(", "$", "campaignId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "'/v2/campaigns/'", ".", "$", "campaignId", ".", "'/summary'", ";", "$", "this", "->", "setUrl", "(", "$", ...
Gets a summary of reporting information for a specified campaign. @param int $campaignId @return null @throws \Exception
[ "Gets", "a", "summary", "of", "reporting", "information", "for", "a", "specified", "campaign", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1110-L1126
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.deleteContactsTransactionalData
public function deleteContactsTransactionalData( $key, $collectionName = 'Orders' ) { if ($key && $collectionName) { $url = $this->getApiEndpoint() . '/v2/contacts/transactional-data/' . $collectionName . '/' . $key; $this->setUrl($url) ->setVerb('DELETE'); $response = $this->execute(); if (isset($response->message)) { $this->helper->debug( 'deleteContactsTransactionalData', ['DELETE CONTACTS TRANSACTIONAL DATA : ' . $url . ' ' . $response->message] ); } return $response; } }
php
public function deleteContactsTransactionalData( $key, $collectionName = 'Orders' ) { if ($key && $collectionName) { $url = $this->getApiEndpoint() . '/v2/contacts/transactional-data/' . $collectionName . '/' . $key; $this->setUrl($url) ->setVerb('DELETE'); $response = $this->execute(); if (isset($response->message)) { $this->helper->debug( 'deleteContactsTransactionalData', ['DELETE CONTACTS TRANSACTIONAL DATA : ' . $url . ' ' . $response->message] ); } return $response; } }
[ "public", "function", "deleteContactsTransactionalData", "(", "$", "key", ",", "$", "collectionName", "=", "'Orders'", ")", "{", "if", "(", "$", "key", "&&", "$", "collectionName", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ...
Deletes a piece of transactional data by key. @param int $key @param string $collectionName @return null @throws \Exception
[ "Deletes", "a", "piece", "of", "transactional", "data", "by", "key", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1137-L1159
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.postCampaignAttachments
public function postCampaignAttachments($campaignId, $data) { $url = $this->getApiEndpoint() . self::REST_CREATE_CAMPAIGN . "/$campaignId/attachments"; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $result = $this->execute(); if (isset($result->message)) { $this->helper->debug('postCampaignAttachments', [' CAMPAIGN ATTACHMENT ' . $result->message]); } return $result; }
php
public function postCampaignAttachments($campaignId, $data) { $url = $this->getApiEndpoint() . self::REST_CREATE_CAMPAIGN . "/$campaignId/attachments"; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($data); $result = $this->execute(); if (isset($result->message)) { $this->helper->debug('postCampaignAttachments', [' CAMPAIGN ATTACHMENT ' . $result->message]); } return $result; }
[ "public", "function", "postCampaignAttachments", "(", "$", "campaignId", ",", "$", "data", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CREATE_CAMPAIGN", ".", "\"/$campaignId/attachments\"", ";", "$", "this...
Adds a document to a campaign as an attachment. @param int $campaignId @param array $data @return null @throws \Exception
[ "Adds", "a", "document", "to", "a", "campaign", "as", "an", "attachment", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1170-L1186
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactAddressBooks
public function getContactAddressBooks($contactId) { $url = $this->getApiEndpoint() . '/v2/contacts/' . $contactId . '/address-books'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS ADDRESS BOOKS contact: ' . $contactId . $response->message; $this->helper->debug('getContactAddressBooks', [$message]); } return $response; }
php
public function getContactAddressBooks($contactId) { $url = $this->getApiEndpoint() . '/v2/contacts/' . $contactId . '/address-books'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS ADDRESS BOOKS contact: ' . $contactId . $response->message; $this->helper->debug('getContactAddressBooks', [$message]); } return $response; }
[ "public", "function", "getContactAddressBooks", "(", "$", "contactId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "'/v2/contacts/'", ".", "$", "contactId", ".", "'/address-books'", ";", "$", "this", "->", "setUrl", "(", ...
Get contact address books. @param int $contactId @return object
[ "Get", "contact", "address", "books", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1195-L1211
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getApiTemplateList
public function getApiTemplateList() { $url = $this->getApiEndpoint() . self::REST_TEMPLATES; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET API CONTACT LIST ' . $response->message; $this->helper->debug('getApiTemplateList', [$message]); } return $response; }
php
public function getApiTemplateList() { $url = $this->getApiEndpoint() . self::REST_TEMPLATES; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET API CONTACT LIST ' . $response->message; $this->helper->debug('getApiTemplateList', [$message]); } return $response; }
[ "public", "function", "getApiTemplateList", "(", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_TEMPLATES", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", "'GET'", ")", ...
Gets list of all templates. @return object
[ "Gets", "list", "of", "all", "templates", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1218-L1231
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactsTransactionalDataImportByImportId
public function getContactsTransactionalDataImportByImportId($importId) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA_IMPORT . $importId; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS TRANSACTIONAL DATA IMPORT BY IMPORT ID ' . $response->message; $this->helper->debug('getContactsTransactionalDataImportByImportId', [$message]); } return $response; }
php
public function getContactsTransactionalDataImportByImportId($importId) { $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA_IMPORT . $importId; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); if (isset($response->message)) { $message = 'GET CONTACTS TRANSACTIONAL DATA IMPORT BY IMPORT ID ' . $response->message; $this->helper->debug('getContactsTransactionalDataImportByImportId', [$message]); } return $response; }
[ "public", "function", "getContactsTransactionalDataImportByImportId", "(", "$", "importId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_TRANSACTIONAL_DATA_IMPORT", ".", "$", "importId", ";", "$", "this", "->...
Gets the import status of a previously started transactional import. @param string $importId @return object
[ "Gets", "the", "import", "status", "of", "a", "previously", "started", "transactional", "import", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1329-L1346
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getContactImportReportFaults
public function getContactImportReportFaults($id) { $this->isNotJson = true; $url = $this->getApiEndpoint() . self::REST_CONTACTS_IMPORT . $id . '/report-faults'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); //if string is JSON than there is a error message if (json_decode($response)) { //log error if (isset($response->message)) { $message = 'GET CONTACT IMPORT REPORT FAULTS: ' . $response->message; $this->helper->log($message); } return false; } return $response; }
php
public function getContactImportReportFaults($id) { $this->isNotJson = true; $url = $this->getApiEndpoint() . self::REST_CONTACTS_IMPORT . $id . '/report-faults'; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); //if string is JSON than there is a error message if (json_decode($response)) { //log error if (isset($response->message)) { $message = 'GET CONTACT IMPORT REPORT FAULTS: ' . $response->message; $this->helper->log($message); } return false; } return $response; }
[ "public", "function", "getContactImportReportFaults", "(", "$", "id", ")", "{", "$", "this", "->", "isNotJson", "=", "true", ";", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CONTACTS_IMPORT", ".", "$", "id", "...
Get contact import report faults. @param string $id @return bool|null @throws \Exception
[ "Get", "contact", "import", "report", "faults", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1357-L1378
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getSendStatus
public function getSendStatus($id) { $url = $this->getApiEndpoint() . self::REST_CAMPAIGN_SEND . '/' . $id; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); //log error if (isset($response->message) && !in_array( $response->message, $this->exludeMessages ) ) { $message = 'GETS THE SEND STATUS USING SEND ID: ' . $response->message; $this->helper->log($message); } return $response; }
php
public function getSendStatus($id) { $url = $this->getApiEndpoint() . self::REST_CAMPAIGN_SEND . '/' . $id; $this->setUrl($url) ->setVerb('GET'); $response = $this->execute(); //log error if (isset($response->message) && !in_array( $response->message, $this->exludeMessages ) ) { $message = 'GETS THE SEND STATUS USING SEND ID: ' . $response->message; $this->helper->log($message); } return $response; }
[ "public", "function", "getSendStatus", "(", "$", "id", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_CAMPAIGN_SEND", ".", "'/'", ".", "$", "id", ";", "$", "this", "->", "setUrl", "(", "$", "url", ...
Gets the send status using send ID. @param string $id @return object
[ "Gets", "the", "send", "status", "using", "send", "ID", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1386-L1404
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.sendApiTransactionalEmail
public function sendApiTransactionalEmail($content) { $url = $this->getApiEndpoint() . self::REST_SEND_TRANSACTIONAL_EMAIL; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($content); $this->execute(); }
php
public function sendApiTransactionalEmail($content) { $url = $this->getApiEndpoint() . self::REST_SEND_TRANSACTIONAL_EMAIL; $this->setUrl($url) ->setVerb('POST') ->buildPostBody($content); $this->execute(); }
[ "public", "function", "sendApiTransactionalEmail", "(", "$", "content", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "self", "::", "REST_SEND_TRANSACTIONAL_EMAIL", ";", "$", "this", "->", "setUrl", "(", "$", "url", ")", "-...
Sends a transactional email. @param string $content @return mixed
[ "Sends", "a", "transactional", "email", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1448-L1457
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getEmailStats
public function getEmailStats($date, $endDate = null, $aggregatedBy = null) { $url = $this->getApiEndpoint() . '/v2/email/stats/since-date/' . $date; if ($endDate && $aggregatedBy) { $url .= '?endDate=' . $endDate . '&aggregatedBy=' . $aggregatedBy; } $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET EMAIL STATS : ' . $response->message); } return $response; }
php
public function getEmailStats($date, $endDate = null, $aggregatedBy = null) { $url = $this->getApiEndpoint() . '/v2/email/stats/since-date/' . $date; if ($endDate && $aggregatedBy) { $url .= '?endDate=' . $endDate . '&aggregatedBy=' . $aggregatedBy; } $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET EMAIL STATS : ' . $response->message); } return $response; }
[ "public", "function", "getEmailStats", "(", "$", "date", ",", "$", "endDate", "=", "null", ",", "$", "aggregatedBy", "=", "null", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "'/v2/email/stats/since-date/'", ".", "$", "d...
Gets transactional email reporting statistics for a specified time period. @param string $date @param null $endDate @param null $aggregatedBy 'AllTime', 'Month', 'Week', 'Day' @return mixed
[ "Gets", "transactional", "email", "reporting", "statistics", "for", "a", "specified", "time", "period", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1468-L1484
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getPreferencesForContact
public function getPreferencesForContact($contactId) { $url = $this->getApiEndpoint() . "/v2/contact/" . $contactId . "/preferences"; $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET PREFERENCES FOR CONTACT: ' . $response->message); } return $response; }
php
public function getPreferencesForContact($contactId) { $url = $this->getApiEndpoint() . "/v2/contact/" . $contactId . "/preferences"; $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET PREFERENCES FOR CONTACT: ' . $response->message); } return $response; }
[ "public", "function", "getPreferencesForContact", "(", "$", "contactId", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "\"/v2/contact/\"", ".", "$", "contactId", ".", "\"/preferences\"", ";", "$", "response", "=", "$", "this"...
Gets all preferences that a given contact is opted into @param $contactId @return mixed
[ "Gets", "all", "preferences", "that", "a", "given", "contact", "is", "opted", "into" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1492-L1505
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.setPreferencesForContact
public function setPreferencesForContact($contactId, $preferences) { $url = $this->getApiEndpoint() . "/v2/contact/" . $contactId . "/preferences"; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($preferences); $response = $this->execute(); if (isset($response->message)) { $this->helper->log('SET PREFERENCES FOR CONTACT: ' . $response->message); } return $response; }
php
public function setPreferencesForContact($contactId, $preferences) { $url = $this->getApiEndpoint() . "/v2/contact/" . $contactId . "/preferences"; $this->setUrl($url) ->setVerb('PUT') ->buildPostBody($preferences); $response = $this->execute(); if (isset($response->message)) { $this->helper->log('SET PREFERENCES FOR CONTACT: ' . $response->message); } return $response; }
[ "public", "function", "setPreferencesForContact", "(", "$", "contactId", ",", "$", "preferences", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "\"/v2/contact/\"", ".", "$", "contactId", ".", "\"/preferences\"", ";", "$", "th...
Opts in a given contact to preferences, or opts out a given contact from preferences @param $contactId @param $preferences @return mixed
[ "Opts", "in", "a", "given", "contact", "to", "preferences", "or", "opts", "out", "a", "given", "contact", "from", "preferences" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1515-L1529
train
dotmailer/dotmailer-magento2-extension
Model/Apiconnector/Client.php
Client.getPreferences
public function getPreferences() { $url = $this->getApiEndpoint() . "/v2/preferences"; $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET PREFERENCES: ' . $response->message); } return $response; }
php
public function getPreferences() { $url = $this->getApiEndpoint() . "/v2/preferences"; $response = $this->setUrl($url) ->setVerb('GET') ->execute(); if (isset($response->message)) { $this->helper->log('GET PREFERENCES: ' . $response->message); } return $response; }
[ "public", "function", "getPreferences", "(", ")", "{", "$", "url", "=", "$", "this", "->", "getApiEndpoint", "(", ")", ".", "\"/v2/preferences\"", ";", "$", "response", "=", "$", "this", "->", "setUrl", "(", "$", "url", ")", "->", "setVerb", "(", "'GET...
Gets the preferences, as a tree structure @return mixed
[ "Gets", "the", "preferences", "as", "a", "tree", "structure" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Client.php#L1567-L1580
train
dotmailer/dotmailer-magento2-extension
Model/Customer/Guest.php
Guest.sync
public function sync() { $this->start = microtime(true); $websites = $this->helper->getWebsites(); foreach ($websites as $website) { //check if the guest is mapped and enabled $addresbook = $this->helper->getGuestAddressBook($website); $guestSyncEnabled = $this->helper->isGuestSyncEnabled($website); $apiEnabled = $this->helper->isEnabled($website); if ($addresbook && $guestSyncEnabled && $apiEnabled) { //sync guests for website $this->exportGuestPerWebsite($website); } } if ($this->countGuests) { $this->helper->log( '----------- Guest sync ----------- : ' . gmdate('H:i:s', microtime(true) - $this->start) . ', Total synced = ' . $this->countGuests ); } }
php
public function sync() { $this->start = microtime(true); $websites = $this->helper->getWebsites(); foreach ($websites as $website) { //check if the guest is mapped and enabled $addresbook = $this->helper->getGuestAddressBook($website); $guestSyncEnabled = $this->helper->isGuestSyncEnabled($website); $apiEnabled = $this->helper->isEnabled($website); if ($addresbook && $guestSyncEnabled && $apiEnabled) { //sync guests for website $this->exportGuestPerWebsite($website); } } if ($this->countGuests) { $this->helper->log( '----------- Guest sync ----------- : ' . gmdate('H:i:s', microtime(true) - $this->start) . ', Total synced = ' . $this->countGuests ); } }
[ "public", "function", "sync", "(", ")", "{", "$", "this", "->", "start", "=", "microtime", "(", "true", ")", ";", "$", "websites", "=", "$", "this", "->", "helper", "->", "getWebsites", "(", ")", ";", "foreach", "(", "$", "websites", "as", "$", "we...
GUEST SYNC. @return null
[ "GUEST", "SYNC", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Customer/Guest.php#L72-L94
train
dotmailer/dotmailer-magento2-extension
Model/Customer/Guest.php
Guest.exportGuestPerWebsite
public function exportGuestPerWebsite($website) { $onlySubscribers = $this->helper->isOnlySubscribersForContactSync($website->getWebsiteId()); $contact = $this->contactFactory->create(); $guests = ($onlySubscribers) ? $contact->getGuests($website, true) : $contact->getGuests($website); //found some guests if ($guests->getSize()) { $guestFilename = strtolower( $website->getCode() . '_guest_' . date('d_m_Y_His') . '.csv' ); $this->helper->log('Guest file: ' . $guestFilename); $storeName = $this->helper->getMappedStoreName($website); $this->file->outputCSV( $this->file->getFilePath($guestFilename), ['Email', 'emailType', $storeName] ); foreach ($guests as $guest) { $this->outputCsvToFile($guest, $website, $guestFilename); } if ($this->countGuests) { //register in queue with importer $this->importerFactory->create() ->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST, '', \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $website->getId(), $guestFilename ); } } }
php
public function exportGuestPerWebsite($website) { $onlySubscribers = $this->helper->isOnlySubscribersForContactSync($website->getWebsiteId()); $contact = $this->contactFactory->create(); $guests = ($onlySubscribers) ? $contact->getGuests($website, true) : $contact->getGuests($website); //found some guests if ($guests->getSize()) { $guestFilename = strtolower( $website->getCode() . '_guest_' . date('d_m_Y_His') . '.csv' ); $this->helper->log('Guest file: ' . $guestFilename); $storeName = $this->helper->getMappedStoreName($website); $this->file->outputCSV( $this->file->getFilePath($guestFilename), ['Email', 'emailType', $storeName] ); foreach ($guests as $guest) { $this->outputCsvToFile($guest, $website, $guestFilename); } if ($this->countGuests) { //register in queue with importer $this->importerFactory->create() ->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST, '', \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $website->getId(), $guestFilename ); } } }
[ "public", "function", "exportGuestPerWebsite", "(", "$", "website", ")", "{", "$", "onlySubscribers", "=", "$", "this", "->", "helper", "->", "isOnlySubscribersForContactSync", "(", "$", "website", "->", "getWebsiteId", "(", ")", ")", ";", "$", "contact", "=",...
Export guests for a website. @param \Magento\Store\Model\Website $website @return null @throws \Magento\Framework\Exception\LocalizedException
[ "Export", "guests", "for", "a", "website", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Customer/Guest.php#L104-L139
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Customer/Attributes/Select.php
Select.toOptionArray
public function toOptionArray() { $options = []; //exclude attributes from mapping $excluded = [ 'created_at', 'created_in', 'dob', 'dotmailer_contact_id', 'email', 'firstname', 'lastname', 'gender', 'group_id', 'password_hash', 'prefix', 'rp_token', 'rp_token_create_at', 'website_id', ]; $attributes = $this->customerFactory->create() ->getAttributes(); foreach ($attributes as $attribute) { if ($attribute->getFrontendLabel()) { $code = $attribute->getAttributeCode(); //escape the label in case of quotes $label = $this->escaper->escapeQuote($attribute->getFrontendLabel()); if (!in_array($code, $excluded)) { $options[] = [ 'value' => $attribute->getAttributeCode(), 'label' => $label, ]; } } } return $options; }
php
public function toOptionArray() { $options = []; //exclude attributes from mapping $excluded = [ 'created_at', 'created_in', 'dob', 'dotmailer_contact_id', 'email', 'firstname', 'lastname', 'gender', 'group_id', 'password_hash', 'prefix', 'rp_token', 'rp_token_create_at', 'website_id', ]; $attributes = $this->customerFactory->create() ->getAttributes(); foreach ($attributes as $attribute) { if ($attribute->getFrontendLabel()) { $code = $attribute->getAttributeCode(); //escape the label in case of quotes $label = $this->escaper->escapeQuote($attribute->getFrontendLabel()); if (!in_array($code, $excluded)) { $options[] = [ 'value' => $attribute->getAttributeCode(), 'label' => $label, ]; } } } return $options; }
[ "public", "function", "toOptionArray", "(", ")", "{", "$", "options", "=", "[", "]", ";", "//exclude attributes from mapping", "$", "excluded", "=", "[", "'created_at'", ",", "'created_in'", ",", "'dob'", ",", "'dotmailer_contact_id'", ",", "'email'", ",", "'fir...
Customer custom attributes. @return array
[ "Customer", "custom", "attributes", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Customer/Attributes/Select.php#L38-L76
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Catalog/StoreCatalogSyncer.php
StoreCatalogSyncer.syncByStore
public function syncByStore($storeId, $websiteId, $limit, $importType) { $products = $this->exporter->exportCatalog($storeId, $limit); $success = $this->importerFactory->create() ->registerQueue( $importType, $products, \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $websiteId ); if ($success) { return $products; } else { $pid = implode(",", array_keys($products)); $msg = "Failed to register with IMPORTER. Type(Catalog) / Scope(Bulk) / Store($storeId) / Product Ids($pid)"; $this->helper->log($msg); } return []; }
php
public function syncByStore($storeId, $websiteId, $limit, $importType) { $products = $this->exporter->exportCatalog($storeId, $limit); $success = $this->importerFactory->create() ->registerQueue( $importType, $products, \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $websiteId ); if ($success) { return $products; } else { $pid = implode(",", array_keys($products)); $msg = "Failed to register with IMPORTER. Type(Catalog) / Scope(Bulk) / Store($storeId) / Product Ids($pid)"; $this->helper->log($msg); } return []; }
[ "public", "function", "syncByStore", "(", "$", "storeId", ",", "$", "websiteId", ",", "$", "limit", ",", "$", "importType", ")", "{", "$", "products", "=", "$", "this", "->", "exporter", "->", "exportCatalog", "(", "$", "storeId", ",", "$", "limit", ")...
Sync by store @param int|null $storeId @param int $websiteId @param int $limit @param string $importType @return array
[ "Sync", "by", "store" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Catalog/StoreCatalogSyncer.php#L50-L71
train
dotmailer/dotmailer-magento2-extension
Model/Rules.php
Rules.process
public function process($collection, $type, $websiteId) { $this->ruleType = $type; $emailRules = $this->getActiveRuleForWebsite($type, $websiteId); //if no rule or condition then return the collection untouched if (empty($emailRules)) { return $collection; } $condition = $this->serializer->unserialize($emailRules->getConditions()); if (empty($condition)) { return $collection; } //process rule on collection according to combination $combination = $emailRules->getCombination(); //join tables to collection according to type $collection = $this->rulesResource->joinTablesOnCollectionByType($collection, $type); if ($combination == self::COMBINATION_TYPE_ALL) { $collection = $this->processAndCombination($collection, $condition); } if ($combination == self::COMBINATION_TYPE_ANY) { $collection = $this->processOrCombination($collection, $condition); } return $collection; }
php
public function process($collection, $type, $websiteId) { $this->ruleType = $type; $emailRules = $this->getActiveRuleForWebsite($type, $websiteId); //if no rule or condition then return the collection untouched if (empty($emailRules)) { return $collection; } $condition = $this->serializer->unserialize($emailRules->getConditions()); if (empty($condition)) { return $collection; } //process rule on collection according to combination $combination = $emailRules->getCombination(); //join tables to collection according to type $collection = $this->rulesResource->joinTablesOnCollectionByType($collection, $type); if ($combination == self::COMBINATION_TYPE_ALL) { $collection = $this->processAndCombination($collection, $condition); } if ($combination == self::COMBINATION_TYPE_ANY) { $collection = $this->processOrCombination($collection, $condition); } return $collection; }
[ "public", "function", "process", "(", "$", "collection", ",", "$", "type", ",", "$", "websiteId", ")", "{", "$", "this", "->", "ruleType", "=", "$", "type", ";", "$", "emailRules", "=", "$", "this", "->", "getActiveRuleForWebsite", "(", "$", "type", ",...
Process rule on collection. @param \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collection $collection @param string $type @param int $websiteId @return \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collection $collection
[ "Process", "rule", "on", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Rules.php#L233-L261
train
dotmailer/dotmailer-magento2-extension
Model/Rules.php
Rules.processAndCombination
public function processAndCombination($collection, $conditions) { foreach ($conditions as $condition) { $attribute = $condition['attribute']; $cond = $condition['conditions']; $value = $condition['cvalue']; //ignore condition if value is null or empty if ($value == '' || $value == null) { continue; } //ignore conditions for already used attribute if (in_array($attribute, $this->used)) { continue; } //set used to check later $this->used[] = $attribute; //product review if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) { $attribute = $this->attributeMapForOrder[$attribute]; //abandoned cart } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) { $attribute = $this->attributeMapForQuote[$attribute]; } else { $this->productAttribute[] = $condition; continue; } $collection = $this->processProcessAndCombinationCondition($collection, $cond, $value, $attribute); } return $this->processProductAttributes($collection); }
php
public function processAndCombination($collection, $conditions) { foreach ($conditions as $condition) { $attribute = $condition['attribute']; $cond = $condition['conditions']; $value = $condition['cvalue']; //ignore condition if value is null or empty if ($value == '' || $value == null) { continue; } //ignore conditions for already used attribute if (in_array($attribute, $this->used)) { continue; } //set used to check later $this->used[] = $attribute; //product review if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) { $attribute = $this->attributeMapForOrder[$attribute]; //abandoned cart } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) { $attribute = $this->attributeMapForQuote[$attribute]; } else { $this->productAttribute[] = $condition; continue; } $collection = $this->processProcessAndCombinationCondition($collection, $cond, $value, $attribute); } return $this->processProductAttributes($collection); }
[ "public", "function", "processAndCombination", "(", "$", "collection", ",", "$", "conditions", ")", "{", "foreach", "(", "$", "conditions", "as", "$", "condition", ")", "{", "$", "attribute", "=", "$", "condition", "[", "'attribute'", "]", ";", "$", "cond"...
Process And combination on collection. @param \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collectio $collection @param array $conditions @return \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collection $collection
[ "Process", "And", "combination", "on", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Rules.php#L273-L307
train
dotmailer/dotmailer-magento2-extension
Model/Rules.php
Rules.processOrCombination
public function processOrCombination($collection, $conditions) { $fieldsConditions = []; $multiFieldsConditions = []; foreach ($conditions as $condition) { $attribute = $condition['attribute']; $cond = $condition['conditions']; $value = $condition['cvalue']; //ignore condition if value is null or empty if ($value == '' or $value == null) { continue; } if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) { $attribute = $this->attributeMapForOrder[$attribute]; } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) { $attribute = $this->attributeMapForQuote[$attribute]; } else { $this->productAttribute[] = $condition; continue; } if ($cond == 'null') { if ($value == '1') { if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = ['notnull' => true]; continue; } $fieldsConditions[$attribute] = ['notnull' => true]; } elseif ($value == '0') { if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = [$cond => true]; continue; } $fieldsConditions[$attribute] = [$cond => true]; } } else { if ($cond == 'like' or $cond == 'nlike') { $value = '%' . $value . '%'; } if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = [$this->conditionMap[$cond] => $value]; continue; } $fieldsConditions[$attribute] = [$this->conditionMap[$cond] => $value]; } } //all rules condition will be with or combination if (!empty($fieldsConditions)) { $column = $cond = []; foreach ($fieldsConditions as $key => $fieldsCondition) { $column[] = (string)$key; $cond[] = $fieldsCondition; if (!empty($multiFieldsConditions[$key])) { foreach ($multiFieldsConditions[$key] as $multiFieldsCondition) { $column[] = (string)$key; $cond[] = $multiFieldsCondition; } } } $collection->addFieldToFilter( $column, $cond ); } return $this->processProductAttributes($collection); }
php
public function processOrCombination($collection, $conditions) { $fieldsConditions = []; $multiFieldsConditions = []; foreach ($conditions as $condition) { $attribute = $condition['attribute']; $cond = $condition['conditions']; $value = $condition['cvalue']; //ignore condition if value is null or empty if ($value == '' or $value == null) { continue; } if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) { $attribute = $this->attributeMapForOrder[$attribute]; } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) { $attribute = $this->attributeMapForQuote[$attribute]; } else { $this->productAttribute[] = $condition; continue; } if ($cond == 'null') { if ($value == '1') { if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = ['notnull' => true]; continue; } $fieldsConditions[$attribute] = ['notnull' => true]; } elseif ($value == '0') { if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = [$cond => true]; continue; } $fieldsConditions[$attribute] = [$cond => true]; } } else { if ($cond == 'like' or $cond == 'nlike') { $value = '%' . $value . '%'; } if (isset($fieldsConditions[$attribute])) { $multiFieldsConditions[$attribute][] = [$this->conditionMap[$cond] => $value]; continue; } $fieldsConditions[$attribute] = [$this->conditionMap[$cond] => $value]; } } //all rules condition will be with or combination if (!empty($fieldsConditions)) { $column = $cond = []; foreach ($fieldsConditions as $key => $fieldsCondition) { $column[] = (string)$key; $cond[] = $fieldsCondition; if (!empty($multiFieldsConditions[$key])) { foreach ($multiFieldsConditions[$key] as $multiFieldsCondition) { $column[] = (string)$key; $cond[] = $multiFieldsCondition; } } } $collection->addFieldToFilter( $column, $cond ); } return $this->processProductAttributes($collection); }
[ "public", "function", "processOrCombination", "(", "$", "collection", ",", "$", "conditions", ")", "{", "$", "fieldsConditions", "=", "[", "]", ";", "$", "multiFieldsConditions", "=", "[", "]", ";", "foreach", "(", "$", "conditions", "as", "$", "condition", ...
process Or combination on collection. @param \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collectio $collection @param array $conditions @param string $type @return \Magento\Sales\Model\ResourceModel\Order\Collection| \Magento\Quote\Model\ResourceModel\Quote\Collection $collection @SuppressWarnings(PHPMD.NPathComplexity) @SuppressWarnings(PHPMD.CyclomaticComplexity)
[ "process", "Or", "combination", "on", "collection", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Rules.php#L363-L434
train
dotmailer/dotmailer-magento2-extension
Model/Rules.php
Rules._evaluate
public function _evaluate($varOne, $op, $varTwo) { switch ($op) { case 'eq': return $varOne == $varTwo; case 'neq': return $varOne != $varTwo; case 'gteq': return $varOne >= $varTwo; case 'lteq': return $varOne <= $varTwo; case 'gt': return $varOne > $varTwo; case 'lt': return $varOne < $varTwo; } return false; }
php
public function _evaluate($varOne, $op, $varTwo) { switch ($op) { case 'eq': return $varOne == $varTwo; case 'neq': return $varOne != $varTwo; case 'gteq': return $varOne >= $varTwo; case 'lteq': return $varOne <= $varTwo; case 'gt': return $varOne > $varTwo; case 'lt': return $varOne < $varTwo; } return false; }
[ "public", "function", "_evaluate", "(", "$", "varOne", ",", "$", "op", ",", "$", "varTwo", ")", "{", "switch", "(", "$", "op", ")", "{", "case", "'eq'", ":", "return", "$", "varOne", "==", "$", "varTwo", ";", "case", "'neq'", ":", "return", "$", ...
Evaluate two values against condition. @param string $varOne @param string $op @param string $varTwo @return bool
[ "Evaluate", "two", "values", "against", "condition", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Rules.php#L466-L484
train
dotmailer/dotmailer-magento2-extension
Model/Customer/Wishlist.php
Wishlist.setItem
public function setItem($item) { $this->items[] = $item->expose(); $this->totalWishlistValue += $item->getTotalValueOfProduct(); }
php
public function setItem($item) { $this->items[] = $item->expose(); $this->totalWishlistValue += $item->getTotalValueOfProduct(); }
[ "public", "function", "setItem", "(", "$", "item", ")", "{", "$", "this", "->", "items", "[", "]", "=", "$", "item", "->", "expose", "(", ")", ";", "$", "this", "->", "totalWishlistValue", "+=", "$", "item", "->", "getTotalValueOfProduct", "(", ")", ...
Set wishlist item. @param \Dotdigitalgroup\Email\Model\Customer\Wishlist\Item $item @return null
[ "Set", "wishlist", "item", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Customer/Wishlist.php#L116-L121
train
dotmailer/dotmailer-magento2-extension
Model/Customer/Wishlist.php
Wishlist.setUpdatedAt
public function setUpdatedAt($date) { $date = $this->localeDate->date($date) ->format(\Zend_Date::ISO_8601); $this->updatedAt = $date; return $this; }
php
public function setUpdatedAt($date) { $date = $this->localeDate->date($date) ->format(\Zend_Date::ISO_8601); $this->updatedAt = $date; return $this; }
[ "public", "function", "setUpdatedAt", "(", "$", "date", ")", "{", "$", "date", "=", "$", "this", "->", "localeDate", "->", "date", "(", "$", "date", ")", "->", "format", "(", "\\", "Zend_Date", "::", "ISO_8601", ")", ";", "$", "this", "->", "updatedA...
Set wishlist date. @param string $date @return $this;
[ "Set", "wishlist", "date", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Customer/Wishlist.php#L146-L153
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Condition.php
Condition.getInputTypeOptions
public function getInputTypeOptions($type) { switch ($type) { case 'numeric': return $this->optionsForNumericType(); case 'select': return $this->toOptionArray(); case 'string': return $this->optionsForStringType(); } return $this->optionsForStringType(); }
php
public function getInputTypeOptions($type) { switch ($type) { case 'numeric': return $this->optionsForNumericType(); case 'select': return $this->toOptionArray(); case 'string': return $this->optionsForStringType(); } return $this->optionsForStringType(); }
[ "public", "function", "getInputTypeOptions", "(", "$", "type", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'numeric'", ":", "return", "$", "this", "->", "optionsForNumericType", "(", ")", ";", "case", "'select'", ":", "return", "$", "this", ...
Get condition options according to type. @param string $type @return array
[ "Get", "condition", "options", "according", "to", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Condition.php#L30-L44
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Condition.php
Condition.optionsForNumericType
private function optionsForNumericType() { $options = $this->toOptionArray(); $options[] = [ 'value' => 'gteq', 'label' => __('equals or greater than'), ]; $options[] = [ 'value' => 'lteq', 'label' => __('equals or less then'), ]; $options[] = ['value' => 'gt', 'label' => __('greater than')]; $options[] = ['value' => 'lt', 'label' => __('less than')]; return $options; }
php
private function optionsForNumericType() { $options = $this->toOptionArray(); $options[] = [ 'value' => 'gteq', 'label' => __('equals or greater than'), ]; $options[] = [ 'value' => 'lteq', 'label' => __('equals or less then'), ]; $options[] = ['value' => 'gt', 'label' => __('greater than')]; $options[] = ['value' => 'lt', 'label' => __('less than')]; return $options; }
[ "private", "function", "optionsForNumericType", "(", ")", "{", "$", "options", "=", "$", "this", "->", "toOptionArray", "(", ")", ";", "$", "options", "[", "]", "=", "[", "'value'", "=>", "'gteq'", ",", "'label'", "=>", "__", "(", "'equals or greater than'...
Condition options for numeric type. @return array
[ "Condition", "options", "for", "numeric", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Condition.php#L51-L66
train
dotmailer/dotmailer-magento2-extension
Model/Automation/UpdateFields/Update.php
Update.updateAbandonedCartDatafields
public function updateAbandonedCartDatafields($email, $websiteId, $quoteId, $parentStoreName) { $website = $this->storeManager->getWebsite($websiteId); // Load the origin quote $quoteModel = $this->magentoQuoteFactory->create() ->loadByIdWithoutStore($quoteId); $items = $quoteModel->getAllItems(); // Nominate the most expensive item in the cart as the 'abandoned product' $nominatedAbandonedCartItem = $this->ddgQuoteFactory->create() ->getMostExpensiveItems($items); if ($lastQuoteId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_LAST_QUOTE_ID ) ) { $data[] = [ 'Key' => $lastQuoteId, 'Value' => $quoteId, ]; } if ($abandonedProductName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_PRODUCT_NAME ) ) { $data[] = [ 'Key' => $abandonedProductName, 'Value' => $nominatedAbandonedCartItem->getName(), ]; } if ($storeName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME ) ) { $data[] = [ 'Key' => $storeName, 'Value' => $parentStoreName, ]; } if ($websiteName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME ) ) { $data[] = [ 'Key' => $websiteName, 'Value' => $website->getName(), ]; } if (!empty($data)) { $client = $this->helper->getWebsiteApiClient($website); $client->updateContactDatafieldsByEmail( $email, $data ); } }
php
public function updateAbandonedCartDatafields($email, $websiteId, $quoteId, $parentStoreName) { $website = $this->storeManager->getWebsite($websiteId); // Load the origin quote $quoteModel = $this->magentoQuoteFactory->create() ->loadByIdWithoutStore($quoteId); $items = $quoteModel->getAllItems(); // Nominate the most expensive item in the cart as the 'abandoned product' $nominatedAbandonedCartItem = $this->ddgQuoteFactory->create() ->getMostExpensiveItems($items); if ($lastQuoteId = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_LAST_QUOTE_ID ) ) { $data[] = [ 'Key' => $lastQuoteId, 'Value' => $quoteId, ]; } if ($abandonedProductName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_PRODUCT_NAME ) ) { $data[] = [ 'Key' => $abandonedProductName, 'Value' => $nominatedAbandonedCartItem->getName(), ]; } if ($storeName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME ) ) { $data[] = [ 'Key' => $storeName, 'Value' => $parentStoreName, ]; } if ($websiteName = $website->getConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME ) ) { $data[] = [ 'Key' => $websiteName, 'Value' => $website->getName(), ]; } if (!empty($data)) { $client = $this->helper->getWebsiteApiClient($website); $client->updateContactDatafieldsByEmail( $email, $data ); } }
[ "public", "function", "updateAbandonedCartDatafields", "(", "$", "email", ",", "$", "websiteId", ",", "$", "quoteId", ",", "$", "parentStoreName", ")", "{", "$", "website", "=", "$", "this", "->", "storeManager", "->", "getWebsite", "(", "$", "websiteId", ")...
Update abandoned cart data fields. @param string $email @param int $websiteId @param int $quoteId @param string $parentStoreName @return void @throws \Magento\Framework\Exception\LocalizedException
[ "Update", "abandoned", "cart", "data", "fields", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Automation/UpdateFields/Update.php#L58-L114
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Value.php
Value.getValueElementType
public function getValueElementType($attribute) { switch ($attribute) { 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 ); if ($attribute->usesSource()) { return 'select'; } } return 'text'; }
php
public function getValueElementType($attribute) { switch ($attribute) { 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 ); if ($attribute->usesSource()) { return 'select'; } } return 'text'; }
[ "public", "function", "getValueElementType", "(", "$", "attribute", ")", "{", "switch", "(", "$", "attribute", ")", "{", "case", "'method'", ":", "case", "'shipping_method'", ":", "case", "'country_id'", ":", "case", "'region_id'", ":", "case", "'customer_group_...
Get element type. @param string $attribute @return string
[ "Get", "element", "type", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Value.php#L78-L99
train
dotmailer/dotmailer-magento2-extension
Model/Adminhtml/Source/Rules/Value.php
Value.getValueSelectOptions
public function getValueSelectOptions($attribute, $isEmpty = false) { $options = []; if ($isEmpty) { $options = $this->yesno->toOptionArray(); return $options; } switch ($attribute) { case 'country_id': $options = $this->country->toOptionArray(); break; case 'region_id': $options = $this->allregion->toOptionArray(); break; case 'shipping_method': $options = $this->allShippingMethods->toOptionArray(); break; case 'method': $options = $this->allPaymentMethods->toOptionArray(); break; case 'customer_group_id': $options = $this->sourceGroup->toOptionArray(); break; default: $attribute = $this->configFactory->getAttribute( 'catalog_product', $attribute ); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(); } } return $options; }
php
public function getValueSelectOptions($attribute, $isEmpty = false) { $options = []; if ($isEmpty) { $options = $this->yesno->toOptionArray(); return $options; } switch ($attribute) { case 'country_id': $options = $this->country->toOptionArray(); break; case 'region_id': $options = $this->allregion->toOptionArray(); break; case 'shipping_method': $options = $this->allShippingMethods->toOptionArray(); break; case 'method': $options = $this->allPaymentMethods->toOptionArray(); break; case 'customer_group_id': $options = $this->sourceGroup->toOptionArray(); break; default: $attribute = $this->configFactory->getAttribute( 'catalog_product', $attribute ); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(); } } return $options; }
[ "public", "function", "getValueSelectOptions", "(", "$", "attribute", ",", "$", "isEmpty", "=", "false", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "$", "isEmpty", ")", "{", "$", "options", "=", "$", "this", "->", "yesno", "->", "toOpti...
Get options array. @param string $attribute @param bool $isEmpty @return array
[ "Get", "options", "array", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Adminhtml/Source/Rules/Value.php#L109-L152
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Order.php
Order.sync
public function sync() { $response = ['success' => true, 'message' => 'Done.']; // Initialise a return hash containing results of our sync attempt $this->searchWebsiteAccounts(); foreach ($this->accounts as $account) { $orders = $account->getOrders(); $ordersForSingleSync = $account->getOrdersForSingleSync(); $numOrders = count($orders); $numOrdersForSingleSync = count($ordersForSingleSync); $website = $account->getWebsites(); $this->countOrders += $numOrders; $this->countOrders += $numOrdersForSingleSync; //create bulk if ($numOrders) { $this->helper->log('--------- Order sync ---------- : ' . $numOrders); //queue order into importer $this->importerFactory->create() ->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS, $orders, \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $website[0] ); } //create single if ($numOrdersForSingleSync) { $this->createSingleImports($ordersForSingleSync, $website); } //mark the orders as imported $this->orderResource->setImported($this->orderIds); unset($this->accounts[$account->getApiUsername()]); } /** * Add guests to contact table. */ if (! empty($this->guests)) { $orderEmails = array_keys($this->guests); $guestsEmailFound = $this->contactCollectionFactory->create() ->addFieldToFilter('email', ['in' => $orderEmails]) ->getColumnValues('email'); //remove the contacts that already exists foreach ($guestsEmailFound as $email) { unset($this->guests[strtolower($email)]); } //insert new guests contacts $this->contactResource->insertGuests($this->guests); //mark the existing contacts with is guest in bulk $this->contactResource->updateContactsAsGuests($guestsEmailFound); } if ($this->countOrders) { $response['message'] = 'Orders updated ' . $this->countOrders; } return $response; }
php
public function sync() { $response = ['success' => true, 'message' => 'Done.']; // Initialise a return hash containing results of our sync attempt $this->searchWebsiteAccounts(); foreach ($this->accounts as $account) { $orders = $account->getOrders(); $ordersForSingleSync = $account->getOrdersForSingleSync(); $numOrders = count($orders); $numOrdersForSingleSync = count($ordersForSingleSync); $website = $account->getWebsites(); $this->countOrders += $numOrders; $this->countOrders += $numOrdersForSingleSync; //create bulk if ($numOrders) { $this->helper->log('--------- Order sync ---------- : ' . $numOrders); //queue order into importer $this->importerFactory->create() ->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS, $orders, \Dotdigitalgroup\Email\Model\Importer::MODE_BULK, $website[0] ); } //create single if ($numOrdersForSingleSync) { $this->createSingleImports($ordersForSingleSync, $website); } //mark the orders as imported $this->orderResource->setImported($this->orderIds); unset($this->accounts[$account->getApiUsername()]); } /** * Add guests to contact table. */ if (! empty($this->guests)) { $orderEmails = array_keys($this->guests); $guestsEmailFound = $this->contactCollectionFactory->create() ->addFieldToFilter('email', ['in' => $orderEmails]) ->getColumnValues('email'); //remove the contacts that already exists foreach ($guestsEmailFound as $email) { unset($this->guests[strtolower($email)]); } //insert new guests contacts $this->contactResource->insertGuests($this->guests); //mark the existing contacts with is guest in bulk $this->contactResource->updateContactsAsGuests($guestsEmailFound); } if ($this->countOrders) { $response['message'] = 'Orders updated ' . $this->countOrders; } return $response; }
[ "public", "function", "sync", "(", ")", "{", "$", "response", "=", "[", "'success'", "=>", "true", ",", "'message'", "=>", "'Done.'", "]", ";", "// Initialise a return hash containing results of our sync attempt", "$", "this", "->", "searchWebsiteAccounts", "(", ")"...
Initial sync the transactional data. @return array @throws \Magento\Framework\Exception\LocalizedException
[ "Initial", "sync", "the", "transactional", "data", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Order.php#L130-L192
train
dotmailer/dotmailer-magento2-extension
Model/Sync/Order.php
Order.searchWebsiteAccounts
public function searchWebsiteAccounts() { $websites = $this->helper->getWebsites(); foreach ($websites as $website) { $apiEnabled = $this->helper->isEnabled($website); $storeIds = $website->getStoreIds(); // api and order sync should be enabled, skip website with no store ids if ($apiEnabled && $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, $website ) && !empty($storeIds) ) { $this->apiUsername = $this->helper->getApiUsername($website); $this->apiPassword = $this->helper->getApiPassword($website); // limit for orders included to sync $limit = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT, $website ); //set account for later use if (! isset($this->accounts[$this->apiUsername])) { $account = $this->accountFactory->create(); $account->setApiUsername($this->apiUsername); $account->setApiPassword($this->apiPassword); $this->accounts[$this->apiUsername] = $account; } $pendingOrders = $this->getPendingConnectorOrders($website, $limit); if (! empty($pendingOrders)) { $this->accounts[$this->apiUsername]->setOrders($pendingOrders); } $this->accounts[$this->apiUsername]->setWebsites($website->getId()); $modifiedOrders = $this->getModifiedOrders($website, $limit); if (! empty($modifiedOrders)) { $this->accounts[$this->apiUsername]->setOrdersForSingleSync($modifiedOrders); } } } }
php
public function searchWebsiteAccounts() { $websites = $this->helper->getWebsites(); foreach ($websites as $website) { $apiEnabled = $this->helper->isEnabled($website); $storeIds = $website->getStoreIds(); // api and order sync should be enabled, skip website with no store ids if ($apiEnabled && $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, $website ) && !empty($storeIds) ) { $this->apiUsername = $this->helper->getApiUsername($website); $this->apiPassword = $this->helper->getApiPassword($website); // limit for orders included to sync $limit = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT, $website ); //set account for later use if (! isset($this->accounts[$this->apiUsername])) { $account = $this->accountFactory->create(); $account->setApiUsername($this->apiUsername); $account->setApiPassword($this->apiPassword); $this->accounts[$this->apiUsername] = $account; } $pendingOrders = $this->getPendingConnectorOrders($website, $limit); if (! empty($pendingOrders)) { $this->accounts[$this->apiUsername]->setOrders($pendingOrders); } $this->accounts[$this->apiUsername]->setWebsites($website->getId()); $modifiedOrders = $this->getModifiedOrders($website, $limit); if (! empty($modifiedOrders)) { $this->accounts[$this->apiUsername]->setOrdersForSingleSync($modifiedOrders); } } } }
[ "public", "function", "searchWebsiteAccounts", "(", ")", "{", "$", "websites", "=", "$", "this", "->", "helper", "->", "getWebsites", "(", ")", ";", "foreach", "(", "$", "websites", "as", "$", "website", ")", "{", "$", "apiEnabled", "=", "$", "this", "...
Search the configuration data per website. @throws \Magento\Framework\Exception\LocalizedException @return null
[ "Search", "the", "configuration", "data", "per", "website", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Order.php#L201-L239
train
dotmailer/dotmailer-magento2-extension
Model/Newsletter/SubscriberFilterer.php
SubscriberFilterer.filterBySubscribedStatus
public function filterBySubscribedStatus($collection, $emailColumn = 'customer_email') { $originalCollection = clone $collection; $emails = $originalCollection->getColumnValues($emailColumn); if (! empty($emails)) { $subscriberCollectionFactory = $this->subscriberCollectionFactory->create(); $onlySubscribedEmails = $subscriberCollectionFactory->addFieldToFilter( 'subscriber_email', ['in' => $emails] ) ->addFieldToFilter('subscriber_status', \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) ->getColumnValues('subscriber_email'); $collection->addFieldToFilter($emailColumn, ['in' => $onlySubscribedEmails]); } return $collection; }
php
public function filterBySubscribedStatus($collection, $emailColumn = 'customer_email') { $originalCollection = clone $collection; $emails = $originalCollection->getColumnValues($emailColumn); if (! empty($emails)) { $subscriberCollectionFactory = $this->subscriberCollectionFactory->create(); $onlySubscribedEmails = $subscriberCollectionFactory->addFieldToFilter( 'subscriber_email', ['in' => $emails] ) ->addFieldToFilter('subscriber_status', \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) ->getColumnValues('subscriber_email'); $collection->addFieldToFilter($emailColumn, ['in' => $onlySubscribedEmails]); } return $collection; }
[ "public", "function", "filterBySubscribedStatus", "(", "$", "collection", ",", "$", "emailColumn", "=", "'customer_email'", ")", "{", "$", "originalCollection", "=", "clone", "$", "collection", ";", "$", "emails", "=", "$", "originalCollection", "->", "getColumnVa...
Add filter to collection for subscribers with subscribed status. @param Object $collection @param string $emailColumn @return Object
[ "Add", "filter", "to", "collection", "for", "subscribers", "with", "subscribed", "status", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Newsletter/SubscriberFilterer.php#L28-L46
train
dotmailer/dotmailer-magento2-extension
Model/Connector/Datafield.php
Datafield.getContactDatafields
public function getContactDatafields() { $contactDataFields = $this->contactDatafields; $extraDataFields = $this->getExtraDataFields(); if (! empty($extraDataFields)) { $contactDataFields = array_merge($extraDataFields, $contactDataFields); } return $contactDataFields; }
php
public function getContactDatafields() { $contactDataFields = $this->contactDatafields; $extraDataFields = $this->getExtraDataFields(); if (! empty($extraDataFields)) { $contactDataFields = array_merge($extraDataFields, $contactDataFields); } return $contactDataFields; }
[ "public", "function", "getContactDatafields", "(", ")", "{", "$", "contactDataFields", "=", "$", "this", "->", "contactDatafields", ";", "$", "extraDataFields", "=", "$", "this", "->", "getExtraDataFields", "(", ")", ";", "if", "(", "!", "empty", "(", "$", ...
Get contact datafields. @return array
[ "Get", "contact", "datafields", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Datafield.php#L316-L325
train
dotmailer/dotmailer-magento2-extension
Model/Connector/Datafield.php
Datafield.setDatafield
public function setDatafield( $name, $value, $type = 'string', $visibility = 'private' ) { $this->datafields[] = [ 'name' => $name, 'value' => $value, 'type' => $type, 'visibility' => $visibility, ]; return $this->datafields; }
php
public function setDatafield( $name, $value, $type = 'string', $visibility = 'private' ) { $this->datafields[] = [ 'name' => $name, 'value' => $value, 'type' => $type, 'visibility' => $visibility, ]; return $this->datafields; }
[ "public", "function", "setDatafield", "(", "$", "name", ",", "$", "value", ",", "$", "type", "=", "'string'", ",", "$", "visibility", "=", "'private'", ")", "{", "$", "this", "->", "datafields", "[", "]", "=", "[", "'name'", "=>", "$", "name", ",", ...
Set a single datafield. @param string $name @param string|int|boolean $value @param string $type @param string $visibility @return array
[ "Set", "a", "single", "datafield", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Datafield.php#L337-L351
train
dotmailer/dotmailer-magento2-extension
Block/Customer/Account/Books.php
Books._getApiClient
private function _getApiClient() { if (empty($this->client)) { $website = $this->getCustomer()->getStore()->getWebsite(); $client = $this->helper->getWebsiteApiClient($website); $this->client = $client; } return $this->client; }
php
private function _getApiClient() { if (empty($this->client)) { $website = $this->getCustomer()->getStore()->getWebsite(); $client = $this->helper->getWebsiteApiClient($website); $this->client = $client; } return $this->client; }
[ "private", "function", "_getApiClient", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "client", ")", ")", "{", "$", "website", "=", "$", "this", "->", "getCustomer", "(", ")", "->", "getStore", "(", ")", "->", "getWebsite", "(", ")", "...
Get api client. @return \Dotdigitalgroup\Email\Model\Apiconnector\Client
[ "Get", "api", "client", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Customer/Account/Books.php#L112-L121
train
dotmailer/dotmailer-magento2-extension
Block/Customer/Account/Books.php
Books.getAdditionalBooksToShow
public function getAdditionalBooksToShow() { $additionalBooksToShow = []; $processedAddressBooks = []; $additionalFromConfig = $this->helper->getAddressBookIdsToShow($this->getCustomer()->getStore()->getWebsite()); $contactFromTable = $this->getContactFromTable(); if (! empty($additionalFromConfig) && $contactFromTable->getContactId()) { $contact = $this->getConnectorContact(); if (isset($contact->id) && $contact->status !== 'PendingOptIn') { $addressBooks = $this->_getApiClient() ->getContactAddressBooks( $contact->id ); if (is_array($addressBooks)) { foreach ($addressBooks as $addressBook) { $processedAddressBooks[$addressBook->id] = $addressBook->name; } } } } return $this->getProcessedAdditionalBooks( $additionalFromConfig, $processedAddressBooks, $additionalBooksToShow ); }
php
public function getAdditionalBooksToShow() { $additionalBooksToShow = []; $processedAddressBooks = []; $additionalFromConfig = $this->helper->getAddressBookIdsToShow($this->getCustomer()->getStore()->getWebsite()); $contactFromTable = $this->getContactFromTable(); if (! empty($additionalFromConfig) && $contactFromTable->getContactId()) { $contact = $this->getConnectorContact(); if (isset($contact->id) && $contact->status !== 'PendingOptIn') { $addressBooks = $this->_getApiClient() ->getContactAddressBooks( $contact->id ); if (is_array($addressBooks)) { foreach ($addressBooks as $addressBook) { $processedAddressBooks[$addressBook->id] = $addressBook->name; } } } } return $this->getProcessedAdditionalBooks( $additionalFromConfig, $processedAddressBooks, $additionalBooksToShow ); }
[ "public", "function", "getAdditionalBooksToShow", "(", ")", "{", "$", "additionalBooksToShow", "=", "[", "]", ";", "$", "processedAddressBooks", "=", "[", "]", ";", "$", "additionalFromConfig", "=", "$", "this", "->", "helper", "->", "getAddressBookIdsToShow", "...
Getter for additional books. Fully processed. @return array
[ "Getter", "for", "additional", "books", ".", "Fully", "processed", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Customer/Account/Books.php#L140-L167
train
dotmailer/dotmailer-magento2-extension
Block/Customer/Account/Books.php
Books.getDataFieldsToShow
public function getDataFieldsToShow() { $datafieldsToShow = []; $website = $this->getCustomer()->getStore()->getWebsite(); $dataFieldsFromConfig = $this->_getWebsiteConfigFromHelper( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_SHOW_FIELDS, $website ); if (empty($dataFieldsFromConfig)) { return $datafieldsToShow; } $processedContactDataFields = []; $processedConnectorDataFields = []; $contactFromTable = $this->getContactFromTable(); $dataFieldsFromConfig = explode(',', $dataFieldsFromConfig); if ($contactFromTable->getContactId()) { $contact = $this->getConnectorContact(); if (isset($contact->id)) { $contactDataFields = $contact->dataFields; foreach ($contactDataFields as $contactDataField) { $processedContactDataFields[$contactDataField->key] = $contactDataField->value; } } } return $this->getProcessedDataFieldsToShow( $processedConnectorDataFields, $dataFieldsFromConfig, $processedContactDataFields, $datafieldsToShow ); }
php
public function getDataFieldsToShow() { $datafieldsToShow = []; $website = $this->getCustomer()->getStore()->getWebsite(); $dataFieldsFromConfig = $this->_getWebsiteConfigFromHelper( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ADDRESSBOOK_PREF_SHOW_FIELDS, $website ); if (empty($dataFieldsFromConfig)) { return $datafieldsToShow; } $processedContactDataFields = []; $processedConnectorDataFields = []; $contactFromTable = $this->getContactFromTable(); $dataFieldsFromConfig = explode(',', $dataFieldsFromConfig); if ($contactFromTable->getContactId()) { $contact = $this->getConnectorContact(); if (isset($contact->id)) { $contactDataFields = $contact->dataFields; foreach ($contactDataFields as $contactDataField) { $processedContactDataFields[$contactDataField->key] = $contactDataField->value; } } } return $this->getProcessedDataFieldsToShow( $processedConnectorDataFields, $dataFieldsFromConfig, $processedContactDataFields, $datafieldsToShow ); }
[ "public", "function", "getDataFieldsToShow", "(", ")", "{", "$", "datafieldsToShow", "=", "[", "]", ";", "$", "website", "=", "$", "this", "->", "getCustomer", "(", ")", "->", "getStore", "(", ")", "->", "getWebsite", "(", ")", ";", "$", "dataFieldsFromC...
Getter for datafields to show. Fully processed. @return array
[ "Getter", "for", "datafields", "to", "show", ".", "Fully", "processed", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Customer/Account/Books.php#L186-L221
train
dotmailer/dotmailer-magento2-extension
Block/Customer/Account/Books.php
Books.canShowAnything
public function canShowAnything() { if (! $this->isCustomerSubscriber() || ! $this->helper->isEnabled($this->getCustomer()->getWebsiteId())) { return false; } $showPreferences = $this->getCanShowPreferences(); $books = $this->getAdditionalBooksToShow(); $fields = $this->getDataFieldsToShow(); if ($books || $fields || $showPreferences) { if (! empty($books) || ! empty($fields) || $showPreferences) { return true; } } return false; }
php
public function canShowAnything() { if (! $this->isCustomerSubscriber() || ! $this->helper->isEnabled($this->getCustomer()->getWebsiteId())) { return false; } $showPreferences = $this->getCanShowPreferences(); $books = $this->getAdditionalBooksToShow(); $fields = $this->getDataFieldsToShow(); if ($books || $fields || $showPreferences) { if (! empty($books) || ! empty($fields) || $showPreferences) { return true; } } return false; }
[ "public", "function", "canShowAnything", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isCustomerSubscriber", "(", ")", "||", "!", "$", "this", "->", "helper", "->", "isEnabled", "(", "$", "this", "->", "getCustomer", "(", ")", "->", "getWebsiteId",...
Find out if anything is true. @return bool
[ "Find", "out", "if", "anything", "is", "true", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Customer/Account/Books.php#L228-L244
train
dotmailer/dotmailer-magento2-extension
Block/Customer/Account/Books.php
Books.getConnectorContact
public function getConnectorContact() { if (! isset($this->contactFromAccount)) { $contact = $this->_getApiClient()->getContactByEmail( $this->getCustomer()->getEmail() ); if (isset($contact->id)) { $this->contactFromAccount = $contact; $this->customerSession->setConnectorContactId($contact->id); } } return $this->contactFromAccount; }
php
public function getConnectorContact() { if (! isset($this->contactFromAccount)) { $contact = $this->_getApiClient()->getContactByEmail( $this->getCustomer()->getEmail() ); if (isset($contact->id)) { $this->contactFromAccount = $contact; $this->customerSession->setConnectorContactId($contact->id); } } return $this->contactFromAccount; }
[ "public", "function", "getConnectorContact", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "contactFromAccount", ")", ")", "{", "$", "contact", "=", "$", "this", "->", "_getApiClient", "(", ")", "->", "getContactByEmail", "(", "$", "thi...
Get connector contact. @return object
[ "Get", "connector", "contact", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Customer/Account/Books.php#L261-L274
train
dotmailer/dotmailer-magento2-extension
Observer/Catalog/RemoveProduct.php
RemoveProduct.deleteFromAccount
protected function deleteFromAccount($key) { $apiEnabled = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED ); $catalogEnabled = $this->helper->isCatalogSyncEnabled(); if ($apiEnabled && $catalogEnabled) { $scope = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VALUES ); if ($scope == 1) { //register in queue with importer $this->importerFactory->create() ->registerQueue( 'Catalog_Default', [$key], \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE, \Magento\Store\Model\Store::DEFAULT_STORE_ID ); } if ($scope == 2) { $stores = $this->storeManager->getStores(); foreach ($stores as $store) { $websiteCode = $store->getWebsite()->getCode(); $storeCode = $store->getCode(); //register in queue with importer $this->importerFactory->create() ->registerQueue( 'Catalog_' . $websiteCode . '_' . $storeCode, [$key], \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE, $store->getWebsite()->getId() ); } } } }
php
protected function deleteFromAccount($key) { $apiEnabled = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED ); $catalogEnabled = $this->helper->isCatalogSyncEnabled(); if ($apiEnabled && $catalogEnabled) { $scope = $this->scopeConfig->getValue( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VALUES ); if ($scope == 1) { //register in queue with importer $this->importerFactory->create() ->registerQueue( 'Catalog_Default', [$key], \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE, \Magento\Store\Model\Store::DEFAULT_STORE_ID ); } if ($scope == 2) { $stores = $this->storeManager->getStores(); foreach ($stores as $store) { $websiteCode = $store->getWebsite()->getCode(); $storeCode = $store->getCode(); //register in queue with importer $this->importerFactory->create() ->registerQueue( 'Catalog_' . $websiteCode . '_' . $storeCode, [$key], \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE, $store->getWebsite()->getId() ); } } } }
[ "protected", "function", "deleteFromAccount", "(", "$", "key", ")", "{", "$", "apiEnabled", "=", "$", "this", "->", "scopeConfig", "->", "getValue", "(", "\\", "Dotdigitalgroup", "\\", "Email", "\\", "Helper", "\\", "Config", "::", "XML_PATH_CONNECTOR_API_ENABLE...
Delete piece of transactional data by key. @param int $key @return null
[ "Delete", "piece", "of", "transactional", "data", "by", "key", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Catalog/RemoveProduct.php#L106-L143
train
dotmailer/dotmailer-magento2-extension
Observer/Newsletter/ChangeContactSubscription.php
ChangeContactSubscription.execute
public function execute(\Magento\Framework\Event\Observer $observer) { $subscriber = $observer->getEvent()->getSubscriber(); $this->isSubscriberNew = $subscriber->isObjectNew(); $email = $subscriber->getEmail(); $storeId = $subscriber->getStoreId(); $subscriberStatus = $subscriber->getSubscriberStatus(); $websiteId = $this->storeManager->getStore($subscriber->getStoreId()) ->getWebsiteId(); //api is enabled if (!$this->helper->isEnabled($websiteId)) { return $this; } try { $contactEmail = $this->contactFactory->create() ->loadByCustomerEmail($email, $websiteId); //update the contact $contactEmail->setStoreId($storeId) ->setSubscriberStatus($subscriberStatus); // only for subscribers if ($subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) { //Set contact as subscribed $contactEmail->setSubscriberImported(null) ->setIsSubscriber('1'); //Subscriber subscribed when it is suppressed in table then re-subscribe if ($contactEmail->getSuppressed()) { $this->importerFactory->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBER_RESUBSCRIBED, ['email' => $email], \Dotdigitalgroup\Email\Model\Importer::MODE_SUBSCRIBER_RESUBSCRIBED, $websiteId ); //Set to subscriber imported and reset the subscriber as suppressed $contactEmail->setSubscriberImported(1) ->setSuppressed(null); } //save contact $this->contactResource->save($contactEmail); //not subscribed } else { //skip if contact is suppressed if ($contactEmail->getSuppressed()) { return $this; } $contactEmail->setSubscriberImported(1) ->setIsSubscriber(null); //save contact $this->contactResource->save($contactEmail); //need to confirm enabled, to keep before the subscription data for contentinsight. if ($subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_UNCONFIRMED || $subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_NOT_ACTIVE) { return $this; } //Add subscriber update to importer queue $this->importerFactory->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBER_UPDATE, ['email' => $email, 'id' => $contactEmail->getId()], \Dotdigitalgroup\Email\Model\Importer::MODE_SUBSCRIBER_UPDATE, $websiteId ); } // fix for a multiple hit of the observer. stop adding the duplicates on the automation $emailReg = $this->registry->registry($email . '_subscriber_save'); if ($emailReg) { return $this; } $this->registry->unregister($email . '_subscriber_save'); // additional measure $this->registry->register($email . '_subscriber_save', $email); //add subscriber to automation $this->addSubscriberToAutomation($email, $subscriber, $websiteId); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } return $this; }
php
public function execute(\Magento\Framework\Event\Observer $observer) { $subscriber = $observer->getEvent()->getSubscriber(); $this->isSubscriberNew = $subscriber->isObjectNew(); $email = $subscriber->getEmail(); $storeId = $subscriber->getStoreId(); $subscriberStatus = $subscriber->getSubscriberStatus(); $websiteId = $this->storeManager->getStore($subscriber->getStoreId()) ->getWebsiteId(); //api is enabled if (!$this->helper->isEnabled($websiteId)) { return $this; } try { $contactEmail = $this->contactFactory->create() ->loadByCustomerEmail($email, $websiteId); //update the contact $contactEmail->setStoreId($storeId) ->setSubscriberStatus($subscriberStatus); // only for subscribers if ($subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) { //Set contact as subscribed $contactEmail->setSubscriberImported(null) ->setIsSubscriber('1'); //Subscriber subscribed when it is suppressed in table then re-subscribe if ($contactEmail->getSuppressed()) { $this->importerFactory->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBER_RESUBSCRIBED, ['email' => $email], \Dotdigitalgroup\Email\Model\Importer::MODE_SUBSCRIBER_RESUBSCRIBED, $websiteId ); //Set to subscriber imported and reset the subscriber as suppressed $contactEmail->setSubscriberImported(1) ->setSuppressed(null); } //save contact $this->contactResource->save($contactEmail); //not subscribed } else { //skip if contact is suppressed if ($contactEmail->getSuppressed()) { return $this; } $contactEmail->setSubscriberImported(1) ->setIsSubscriber(null); //save contact $this->contactResource->save($contactEmail); //need to confirm enabled, to keep before the subscription data for contentinsight. if ($subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_UNCONFIRMED || $subscriberStatus == \Magento\Newsletter\Model\Subscriber::STATUS_NOT_ACTIVE) { return $this; } //Add subscriber update to importer queue $this->importerFactory->registerQueue( \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBER_UPDATE, ['email' => $email, 'id' => $contactEmail->getId()], \Dotdigitalgroup\Email\Model\Importer::MODE_SUBSCRIBER_UPDATE, $websiteId ); } // fix for a multiple hit of the observer. stop adding the duplicates on the automation $emailReg = $this->registry->registry($email . '_subscriber_save'); if ($emailReg) { return $this; } $this->registry->unregister($email . '_subscriber_save'); // additional measure $this->registry->register($email . '_subscriber_save', $email); //add subscriber to automation $this->addSubscriberToAutomation($email, $subscriber, $websiteId); } catch (\Exception $e) { $this->helper->debug((string)$e, []); } return $this; }
[ "public", "function", "execute", "(", "\\", "Magento", "\\", "Framework", "\\", "Event", "\\", "Observer", "$", "observer", ")", "{", "$", "subscriber", "=", "$", "observer", "->", "getEvent", "(", ")", "->", "getSubscriber", "(", ")", ";", "$", "this", ...
Change contact subscription status. @param \Magento\Framework\Event\Observer $observer @return $this
[ "Change", "contact", "subscription", "status", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Newsletter/ChangeContactSubscription.php#L94-L178
train
dotmailer/dotmailer-magento2-extension
Observer/Newsletter/ChangeContactSubscription.php
ChangeContactSubscription.addSubscriberToAutomation
private function addSubscriberToAutomation($email, $subscriber, $websiteId) { $storeId = $subscriber->getStoreId(); $store = $this->storeManager->getStore($storeId); $programId = $this->helper->getWebsiteConfig( 'connector_automation/visitor_automation/subscriber_automation', $websiteId ); //not mapped or subscriber is not new then ignore if (! $programId || ! $this->isSubscriberNew) { return; } //save subscriber to the queue $automation = $this->automationFactory->create() ->setEmail($email) ->setAutomationType( \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_SUBSCRIBER ) ->setEnrolmentStatus( \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING ) ->setTypeId($subscriber->getId()) ->setWebsiteId($websiteId) ->setStoreName($store->getName()) ->setProgramId($programId); $this->automationResource->save($automation); }
php
private function addSubscriberToAutomation($email, $subscriber, $websiteId) { $storeId = $subscriber->getStoreId(); $store = $this->storeManager->getStore($storeId); $programId = $this->helper->getWebsiteConfig( 'connector_automation/visitor_automation/subscriber_automation', $websiteId ); //not mapped or subscriber is not new then ignore if (! $programId || ! $this->isSubscriberNew) { return; } //save subscriber to the queue $automation = $this->automationFactory->create() ->setEmail($email) ->setAutomationType( \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_SUBSCRIBER ) ->setEnrolmentStatus( \Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING ) ->setTypeId($subscriber->getId()) ->setWebsiteId($websiteId) ->setStoreName($store->getName()) ->setProgramId($programId); $this->automationResource->save($automation); }
[ "private", "function", "addSubscriberToAutomation", "(", "$", "email", ",", "$", "subscriber", ",", "$", "websiteId", ")", "{", "$", "storeId", "=", "$", "subscriber", "->", "getStoreId", "(", ")", ";", "$", "store", "=", "$", "this", "->", "storeManager",...
Register subscriber to automation. @param string $email @param \Magento\Newsletter\Model\Subscriber $subscriber @param string|int|null $websiteId @return void
[ "Register", "subscriber", "to", "automation", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Newsletter/ChangeContactSubscription.php#L189-L217
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Catalog/Collection.php
Collection.getProductsToExportByStore
public function getProductsToExportByStore($store, $limit) { $connectorCollection = $this; $connectorCollection->addFieldToFilter( ['imported', 'modified'], [ ['null' => 'true'], ['eq' => '1'] ] ); $connectorCollection->getSelect()->limit($limit); $connectorCollection->setOrder( 'product_id', 'asc' ); //check number of products if ($connectorCollection->getSize()) { $productIds = $connectorCollection->getColumnValues('product_id'); $productCollection = $this->productCollection->create() ->addAttributeToSelect('*') ->addAttributeToFilter( 'entity_id', ['in' => $productIds] )->addUrlRewrite(); if (!empty($store)) { $productCollection->addStoreFilter($store); } //visibility filter if ($visibility = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VISIBILITY ) ) { $visibility = explode(',', $visibility); //remove the default option from values $visibility = array_filter($visibility); $productCollection->addAttributeToFilter( 'visibility', ['in' => $visibility] ); } //type filter if ($type = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_TYPE ) ) { $type = explode(',', $type); $productCollection->addAttributeToFilter( 'type_id', ['in' => $type] ); } $productCollection->addWebsiteNamesToResult() ->addCategoryIds() ->addOptionsToResult(); $productCollection->clear(); return $productCollection; } return []; }
php
public function getProductsToExportByStore($store, $limit) { $connectorCollection = $this; $connectorCollection->addFieldToFilter( ['imported', 'modified'], [ ['null' => 'true'], ['eq' => '1'] ] ); $connectorCollection->getSelect()->limit($limit); $connectorCollection->setOrder( 'product_id', 'asc' ); //check number of products if ($connectorCollection->getSize()) { $productIds = $connectorCollection->getColumnValues('product_id'); $productCollection = $this->productCollection->create() ->addAttributeToSelect('*') ->addAttributeToFilter( 'entity_id', ['in' => $productIds] )->addUrlRewrite(); if (!empty($store)) { $productCollection->addStoreFilter($store); } //visibility filter if ($visibility = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VISIBILITY ) ) { $visibility = explode(',', $visibility); //remove the default option from values $visibility = array_filter($visibility); $productCollection->addAttributeToFilter( 'visibility', ['in' => $visibility] ); } //type filter if ($type = $this->helper->getWebsiteConfig( \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_TYPE ) ) { $type = explode(',', $type); $productCollection->addAttributeToFilter( 'type_id', ['in' => $type] ); } $productCollection->addWebsiteNamesToResult() ->addCategoryIds() ->addOptionsToResult(); $productCollection->clear(); return $productCollection; } return []; }
[ "public", "function", "getProductsToExportByStore", "(", "$", "store", ",", "$", "limit", ")", "{", "$", "connectorCollection", "=", "$", "this", ";", "$", "connectorCollection", "->", "addFieldToFilter", "(", "[", "'imported'", ",", "'modified'", "]", ",", "[...
Get product collection to export. @param null|string|bool|int|\Magento\Store\Model\Store $store @param int $limit @return \Magento\Catalog\Model\ResourceModel\Product\Collection|array
[ "Get", "product", "collection", "to", "export", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Catalog/Collection.php#L77-L143
train
dotmailer/dotmailer-magento2-extension
Block/Helper/Font.php
Font.getEscapedFontFamilyForCoupon
public function getEscapedFontFamilyForCoupon() { $rawFont = $this->helper->getWebsiteConfig( Config::XML_PATH_CONNECTOR_DYNAMIC_COUPON_FONT ); return $this->getSanitisedFont($rawFont); }
php
public function getEscapedFontFamilyForCoupon() { $rawFont = $this->helper->getWebsiteConfig( Config::XML_PATH_CONNECTOR_DYNAMIC_COUPON_FONT ); return $this->getSanitisedFont($rawFont); }
[ "public", "function", "getEscapedFontFamilyForCoupon", "(", ")", "{", "$", "rawFont", "=", "$", "this", "->", "helper", "->", "getWebsiteConfig", "(", "Config", "::", "XML_PATH_CONNECTOR_DYNAMIC_COUPON_FONT", ")", ";", "return", "$", "this", "->", "getSanitisedFont"...
Coupon Font from config. @return string|boolean
[ "Coupon", "Font", "from", "config", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Helper/Font.php#L42-L48
train
dotmailer/dotmailer-magento2-extension
Block/Helper/Font.php
Font.getDynamicStyles
public function getDynamicStyles() { $rawDocFont = $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_DOC_FONT); return [ 'nameStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_STYLE) ), 'priceStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_STYLE) ), 'linkStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_STYLE) ), 'otherStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_STYLE) ), 'nameColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_COLOR), 'fontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_FONT_SIZE), 'priceColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_COLOR), 'priceFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_FONT_SIZE), 'urlColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_COLOR), 'urlFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_FONT_SIZE), 'otherColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_COLOR), 'otherFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_FONT_SIZE), 'docFont' => $this->getSanitisedFont($rawDocFont), 'docBackgroundColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_DOC_BG_COLOR), 'dynamicStyling' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_STYLING), ]; }
php
public function getDynamicStyles() { $rawDocFont = $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_DOC_FONT); return [ 'nameStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_STYLE) ), 'priceStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_STYLE) ), 'linkStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_STYLE) ), 'otherStyle' => explode( ',', $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_STYLE) ), 'nameColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_COLOR), 'fontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_NAME_FONT_SIZE), 'priceColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_COLOR), 'priceFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_PRICE_FONT_SIZE), 'urlColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_COLOR), 'urlFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_LINK_FONT_SIZE), 'otherColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_COLOR), 'otherFontSize' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_OTHER_FONT_SIZE), 'docFont' => $this->getSanitisedFont($rawDocFont), 'docBackgroundColor' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_DOC_BG_COLOR), 'dynamicStyling' => $this->helper->getConfigValue(Config::XML_PATH_CONNECTOR_DYNAMIC_STYLING), ]; }
[ "public", "function", "getDynamicStyles", "(", ")", "{", "$", "rawDocFont", "=", "$", "this", "->", "helper", "->", "getConfigValue", "(", "Config", "::", "XML_PATH_CONNECTOR_DYNAMIC_DOC_FONT", ")", ";", "return", "[", "'nameStyle'", "=>", "explode", "(", "','",...
Dynamic styles from config. @return array
[ "Dynamic", "styles", "from", "config", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Helper/Font.php#L77-L109
train
dotmailer/dotmailer-magento2-extension
Controller/Response.php
Response.processFailedRequest
private function processFailedRequest() { $url = $this->_url->getCurrentUrl(); $storeId = $this->storeManager->getStore()->getId(); $failedAuth = $this->failedAuthFactory->create(); $this->failedAuthResource->load($failedAuth, $storeId, 'store_id'); $numOfFails = $failedAuth->getFailuresNum(); $lastAttemptDate = $failedAuth->getLastAttemptDate(); //set the first failed attempt if (!$failedAuth->getId()) { $failedAuth->setFirstAttemptDate(time()); } //check the time for the last fail and update the records if ($numOfFails == \Dotdigitalgroup\Email\Model\FailedAuth::NUMBER_MAX_FAILS_LIMIT) { //ignore the resource is in a locked state if ($failedAuth->isLocked()) { $this->helper->log(sprintf('Resource locked time : %s ,store : %s', $lastAttemptDate, $storeId)); return; } else { //reset with the first lock after the the lock expired $numOfFails = 0; $failedAuth->setFirstAttemptDate(time()); } } try { $failedAuth->setFailuresNum(++$numOfFails) ->setStoreId($storeId) ->setUrl($url) ->setLastAttemptDate(time()); $this->failedAuthResource->save($failedAuth); } catch (\Exception $e) { $this->helper->log($e); } }
php
private function processFailedRequest() { $url = $this->_url->getCurrentUrl(); $storeId = $this->storeManager->getStore()->getId(); $failedAuth = $this->failedAuthFactory->create(); $this->failedAuthResource->load($failedAuth, $storeId, 'store_id'); $numOfFails = $failedAuth->getFailuresNum(); $lastAttemptDate = $failedAuth->getLastAttemptDate(); //set the first failed attempt if (!$failedAuth->getId()) { $failedAuth->setFirstAttemptDate(time()); } //check the time for the last fail and update the records if ($numOfFails == \Dotdigitalgroup\Email\Model\FailedAuth::NUMBER_MAX_FAILS_LIMIT) { //ignore the resource is in a locked state if ($failedAuth->isLocked()) { $this->helper->log(sprintf('Resource locked time : %s ,store : %s', $lastAttemptDate, $storeId)); return; } else { //reset with the first lock after the the lock expired $numOfFails = 0; $failedAuth->setFirstAttemptDate(time()); } } try { $failedAuth->setFailuresNum(++$numOfFails) ->setStoreId($storeId) ->setUrl($url) ->setLastAttemptDate(time()); $this->failedAuthResource->save($failedAuth); } catch (\Exception $e) { $this->helper->log($e); } }
[ "private", "function", "processFailedRequest", "(", ")", "{", "$", "url", "=", "$", "this", "->", "_url", "->", "getCurrentUrl", "(", ")", ";", "$", "storeId", "=", "$", "this", "->", "storeManager", "->", "getStore", "(", ")", "->", "getId", "(", ")",...
Register the failed attempt and set a lock with a 5min window if more then 5 request failed.
[ "Register", "the", "failed", "attempt", "and", "set", "a", "lock", "with", "a", "5min", "window", "if", "more", "then", "5", "request", "failed", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Response.php#L153-L187
train
dotmailer/dotmailer-magento2-extension
Controller/Adminhtml/Studio/Disconnect.php
Disconnect.execute
public function execute() { try { $adminUser = $this->_auth->getUser(); if ($adminUser->getRefreshToken()) { $adminUser->setRefreshToken('') ->save(); } $this->messageManager->addSuccessMessage('Successfully disconnected'); } catch (\Exception $e) { $this->messageManager->addErrorMessage($e->getMessage()); } $this->_redirect('adminhtml/system_config/edit', ['section' => 'connector_developer_settings']); }
php
public function execute() { try { $adminUser = $this->_auth->getUser(); if ($adminUser->getRefreshToken()) { $adminUser->setRefreshToken('') ->save(); } $this->messageManager->addSuccessMessage('Successfully disconnected'); } catch (\Exception $e) { $this->messageManager->addErrorMessage($e->getMessage()); } $this->_redirect('adminhtml/system_config/edit', ['section' => 'connector_developer_settings']); }
[ "public", "function", "execute", "(", ")", "{", "try", "{", "$", "adminUser", "=", "$", "this", "->", "_auth", "->", "getUser", "(", ")", ";", "if", "(", "$", "adminUser", "->", "getRefreshToken", "(", ")", ")", "{", "$", "adminUser", "->", "setRefre...
Disconnect and remote the refresh token. @return void
[ "Disconnect", "and", "remote", "the", "refresh", "token", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Adminhtml/Studio/Disconnect.php#L19-L34
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Cron/Collection.php
Collection._construct
public function _construct() { $this->_init(\Magento\Cron\Model\Schedule::class, \Magento\Cron\Model\ResourceModel\Schedule::class); }
php
public function _construct() { $this->_init(\Magento\Cron\Model\Schedule::class, \Magento\Cron\Model\ResourceModel\Schedule::class); }
[ "public", "function", "_construct", "(", ")", "{", "$", "this", "->", "_init", "(", "\\", "Magento", "\\", "Cron", "\\", "Model", "\\", "Schedule", "::", "class", ",", "\\", "Magento", "\\", "Cron", "\\", "Model", "\\", "ResourceModel", "\\", "Schedule",...
Initialize resource collection @return null
[ "Initialize", "resource", "collection" ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Cron/Collection.php#L18-L21
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.getAllSentOrders
public function getAllSentOrders($storeIds, $limit) { $collection = $this->addFieldToFilter('email_imported', 1) ->addFieldToFilter('store_id', ['in' => $storeIds]); $collection->getSelect()->limit($limit); return $collection->load(); }
php
public function getAllSentOrders($storeIds, $limit) { $collection = $this->addFieldToFilter('email_imported', 1) ->addFieldToFilter('store_id', ['in' => $storeIds]); $collection->getSelect()->limit($limit); return $collection->load(); }
[ "public", "function", "getAllSentOrders", "(", "$", "storeIds", ",", "$", "limit", ")", "{", "$", "collection", "=", "$", "this", "->", "addFieldToFilter", "(", "'email_imported'", ",", "1", ")", "->", "addFieldToFilter", "(", "'store_id'", ",", "[", "'in'",...
Get all sent orders. @param array $storeIds @param int $limit @return $this
[ "Get", "all", "sent", "orders", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L182-L190
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.getSalesCollectionForReviews
public function getSalesCollectionForReviews( $orderStatusFromConfig, $created, $website, $campaignOrderIds = [] ) { $storeIds = $website->getStoreIds(); $collection = $this->orderCollection->create() ->addFieldToFilter( 'main_table.status', $orderStatusFromConfig ) ->addFieldToFilter('main_table.created_at', $created) ->addFieldToFilter( 'main_table.store_id', ['in' => $storeIds] ); if (!empty($campaignOrderIds)) { $collection->addFieldToFilter( 'main_table.increment_id', ['nin' => $campaignOrderIds] ); } if ($this->helper->isOnlySubscribersForReview($website->getWebsiteId())) { $collection = $this->subscriberFilterer->filterBySubscribedStatus($collection); } return $collection; }
php
public function getSalesCollectionForReviews( $orderStatusFromConfig, $created, $website, $campaignOrderIds = [] ) { $storeIds = $website->getStoreIds(); $collection = $this->orderCollection->create() ->addFieldToFilter( 'main_table.status', $orderStatusFromConfig ) ->addFieldToFilter('main_table.created_at', $created) ->addFieldToFilter( 'main_table.store_id', ['in' => $storeIds] ); if (!empty($campaignOrderIds)) { $collection->addFieldToFilter( 'main_table.increment_id', ['nin' => $campaignOrderIds] ); } if ($this->helper->isOnlySubscribersForReview($website->getWebsiteId())) { $collection = $this->subscriberFilterer->filterBySubscribedStatus($collection); } return $collection; }
[ "public", "function", "getSalesCollectionForReviews", "(", "$", "orderStatusFromConfig", ",", "$", "created", ",", "$", "website", ",", "$", "campaignOrderIds", "=", "[", "]", ")", "{", "$", "storeIds", "=", "$", "website", "->", "getStoreIds", "(", ")", ";"...
Get sales collection for review. @param string $orderStatusFromConfig @param array $created @param \Magento\Store\Model\Website $website @param array $campaignOrderIds @return \Magento\Sales\Model\ResourceModel\Order\Collection
[ "Get", "sales", "collection", "for", "review", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L202-L232
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.getCustomerLastQuoteId
public function getCustomerLastQuoteId(\Magento\Customer\Model\Customer $customer, $storeIds) { $collection = $this->quoteCollection->create() ->addFieldToFilter('customer_id', $customer->getId()) ->addFieldToFilter('store_id', ['in' => $storeIds]) ->setPageSize(1) ->setOrder('entity_id'); if ($collection->getSize()) { return $collection->getFirstItem(); } return false; }
php
public function getCustomerLastQuoteId(\Magento\Customer\Model\Customer $customer, $storeIds) { $collection = $this->quoteCollection->create() ->addFieldToFilter('customer_id', $customer->getId()) ->addFieldToFilter('store_id', ['in' => $storeIds]) ->setPageSize(1) ->setOrder('entity_id'); if ($collection->getSize()) { return $collection->getFirstItem(); } return false; }
[ "public", "function", "getCustomerLastQuoteId", "(", "\\", "Magento", "\\", "Customer", "\\", "Model", "\\", "Customer", "$", "customer", ",", "$", "storeIds", ")", "{", "$", "collection", "=", "$", "this", "->", "quoteCollection", "->", "create", "(", ")", ...
Get customer last quote id. @param \Magento\Customer\Model\Customer $customer @param array $storeIds @return boolean|\Magento\Quote\Model\Quote
[ "Get", "customer", "last", "quote", "id", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L265-L278
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.getStoreQuotes
public function getStoreQuotes($storeId, $updated, $guest = false) { $salesCollection = $this->getStoreQuotesForGuestsAndCustomers($storeId, $updated); if ($guest) { $salesCollection->addFieldToFilter('main_table.customer_id', ['null' => true]); } else { $salesCollection->addFieldToFilter('main_table.customer_id', ['notnull' => true]); } return $salesCollection; }
php
public function getStoreQuotes($storeId, $updated, $guest = false) { $salesCollection = $this->getStoreQuotesForGuestsAndCustomers($storeId, $updated); if ($guest) { $salesCollection->addFieldToFilter('main_table.customer_id', ['null' => true]); } else { $salesCollection->addFieldToFilter('main_table.customer_id', ['notnull' => true]); } return $salesCollection; }
[ "public", "function", "getStoreQuotes", "(", "$", "storeId", ",", "$", "updated", ",", "$", "guest", "=", "false", ")", "{", "$", "salesCollection", "=", "$", "this", "->", "getStoreQuotesForGuestsAndCustomers", "(", "$", "storeId", ",", "$", "updated", ")",...
Get store quotes for either guests or customers, excluding inactive and empty. @param int $storeId @param array $updated @param bool $guest @return \Magento\Quote\Model\ResourceModel\Quote\Collection
[ "Get", "store", "quotes", "for", "either", "guests", "or", "customers", "excluding", "inactive", "and", "empty", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L289-L300
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.getStoreQuotesForGuestsAndCustomers
public function getStoreQuotesForGuestsAndCustomers($storeId, $updated) { $salesCollection = $this->quoteCollection->create(); $salesCollection->addFieldToFilter('is_active', 1) ->addFieldToFilter('items_count', ['gt' => 0]) ->addFieldToFilter('customer_email', ['neq' => '']) ->addFieldToFilter('main_table.store_id', $storeId) ->addFieldToFilter('main_table.updated_at', $updated); if ($this->helper->isOnlySubscribersForAC($storeId)) { $salesCollection = $this->subscriberFilterer->filterBySubscribedStatus($salesCollection); } return $salesCollection; }
php
public function getStoreQuotesForGuestsAndCustomers($storeId, $updated) { $salesCollection = $this->quoteCollection->create(); $salesCollection->addFieldToFilter('is_active', 1) ->addFieldToFilter('items_count', ['gt' => 0]) ->addFieldToFilter('customer_email', ['neq' => '']) ->addFieldToFilter('main_table.store_id', $storeId) ->addFieldToFilter('main_table.updated_at', $updated); if ($this->helper->isOnlySubscribersForAC($storeId)) { $salesCollection = $this->subscriberFilterer->filterBySubscribedStatus($salesCollection); } return $salesCollection; }
[ "public", "function", "getStoreQuotesForGuestsAndCustomers", "(", "$", "storeId", ",", "$", "updated", ")", "{", "$", "salesCollection", "=", "$", "this", "->", "quoteCollection", "->", "create", "(", ")", ";", "$", "salesCollection", "->", "addFieldToFilter", "...
Get store quotes for both guests and customers, excluding inactive and empty. @param int $storeId @param array $updated @return \Magento\Quote\Model\ResourceModel\Quote\Collection
[ "Get", "store", "quotes", "for", "both", "guests", "and", "customers", "excluding", "inactive", "and", "empty", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L310-L324
train
dotmailer/dotmailer-magento2-extension
Model/ResourceModel/Order/Collection.php
Collection.checkInSales
public function checkInSales($emails) { $collection = $this->orderCollection->create() ->addFieldToFilter('customer_email', ['in' => $emails]); return $collection->getColumnValues('customer_email'); }
php
public function checkInSales($emails) { $collection = $this->orderCollection->create() ->addFieldToFilter('customer_email', ['in' => $emails]); return $collection->getColumnValues('customer_email'); }
[ "public", "function", "checkInSales", "(", "$", "emails", ")", "{", "$", "collection", "=", "$", "this", "->", "orderCollection", "->", "create", "(", ")", "->", "addFieldToFilter", "(", "'customer_email'", ",", "[", "'in'", "=>", "$", "emails", "]", ")", ...
Check emails exist in sales order table. @param array $emails @return array
[ "Check", "emails", "exist", "in", "sales", "order", "table", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Order/Collection.php#L333-L338
train
dotmailer/dotmailer-magento2-extension
Helper/Transactional.php
Transactional.isEnabled
public function isEnabled($storeId) { return $this->scopeConfig->isSetFlag( self::XML_PATH_DDG_TRANSACTIONAL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
php
public function isEnabled($storeId) { return $this->scopeConfig->isSetFlag( self::XML_PATH_DDG_TRANSACTIONAL_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
[ "public", "function", "isEnabled", "(", "$", "storeId", ")", "{", "return", "$", "this", "->", "scopeConfig", "->", "isSetFlag", "(", "self", "::", "XML_PATH_DDG_TRANSACTIONAL_ENABLED", ",", "\\", "Magento", "\\", "Store", "\\", "Model", "\\", "ScopeInterface", ...
Is transactional email enabled. @param int $storeId @return bool
[ "Is", "transactional", "email", "enabled", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Transactional.php#L46-L53
train
dotmailer/dotmailer-magento2-extension
Helper/Transactional.php
Transactional.getSmtpHost
public function getSmtpHost($storeId) { return $this->scopeConfig->getValue( self::XML_PATH_DDG_TRANSACTIONAL_HOST, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
php
public function getSmtpHost($storeId) { return $this->scopeConfig->getValue( self::XML_PATH_DDG_TRANSACTIONAL_HOST, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
[ "public", "function", "getSmtpHost", "(", "$", "storeId", ")", "{", "return", "$", "this", "->", "scopeConfig", "->", "getValue", "(", "self", "::", "XML_PATH_DDG_TRANSACTIONAL_HOST", ",", "\\", "Magento", "\\", "Store", "\\", "Model", "\\", "ScopeInterface", ...
Get transactional email host. @param int $storeId @return boolean|string
[ "Get", "transactional", "email", "host", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Transactional.php#L62-L69
train
dotmailer/dotmailer-magento2-extension
Helper/Transactional.php
Transactional.getSmtpUsername
private function getSmtpUsername($storeId = null) { return $this->scopeConfig->getValue( self::XML_PATH_DDG_TRANSACTIONAL_USERNAME, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
php
private function getSmtpUsername($storeId = null) { return $this->scopeConfig->getValue( self::XML_PATH_DDG_TRANSACTIONAL_USERNAME, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); }
[ "private", "function", "getSmtpUsername", "(", "$", "storeId", "=", "null", ")", "{", "return", "$", "this", "->", "scopeConfig", "->", "getValue", "(", "self", "::", "XML_PATH_DDG_TRANSACTIONAL_USERNAME", ",", "\\", "Magento", "\\", "Store", "\\", "Model", "\...
Get smtp username. @param int $storeId @return boolean|string
[ "Get", "smtp", "username", "." ]
125eb29932edb08fe3438635034ced12debe2528
https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Transactional.php#L78-L85
train