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 | Controller/Email/Getbasket.php | Getbasket.handleCustomerBasket | private function handleCustomerBasket()
{
/** @var \Magento\Customer\Model\Session $customerSession */
$customerSession = $this->customerSessionFactory->create();
$configCartUrl = $this->quote->getStore()->getWebsite()->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_CART_URL
);
//if customer is logged in then redirect to cart
if ($customerSession->isLoggedIn()
&& $customerSession->getCustomerId() == $this->quote->getCustomerId()) {
$checkoutSession = $this->checkoutSession->create();
if ($checkoutSession->getQuote()
&& $checkoutSession->getQuote()->hasItems()
) {
$quote = $checkoutSession->getQuote();
if ($this->quote->getId() != $quote->getId()) {
$this->checkMissingAndAdd();
}
}
if ($configCartUrl) {
$url = $configCartUrl;
} else {
$url = $this->quote->getStore()->getUrl(
'checkout/cart'
);
}
$this->_redirect($url);
} else {
if ($configCartUrl) {
$cartUrl = $configCartUrl;
} else {
$cartUrl = 'checkout/cart';
}
//set before auth url. customer will be redirected to cart after successful login
$customerSession->setBeforeAuthUrl(
$this->quote->getStore()->getUrl($cartUrl)
);
//send customer to login page
$configLoginUrl = $this->quote->getStore()->getWebsite()
->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_LOGIN_URL
);
if ($configLoginUrl) {
$loginUrl = $configLoginUrl;
} else {
$loginUrl = 'customer/account/login';
}
$this->_redirect($this->quote->getStore()->getUrl($loginUrl));
}
} | php | private function handleCustomerBasket()
{
/** @var \Magento\Customer\Model\Session $customerSession */
$customerSession = $this->customerSessionFactory->create();
$configCartUrl = $this->quote->getStore()->getWebsite()->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_CART_URL
);
//if customer is logged in then redirect to cart
if ($customerSession->isLoggedIn()
&& $customerSession->getCustomerId() == $this->quote->getCustomerId()) {
$checkoutSession = $this->checkoutSession->create();
if ($checkoutSession->getQuote()
&& $checkoutSession->getQuote()->hasItems()
) {
$quote = $checkoutSession->getQuote();
if ($this->quote->getId() != $quote->getId()) {
$this->checkMissingAndAdd();
}
}
if ($configCartUrl) {
$url = $configCartUrl;
} else {
$url = $this->quote->getStore()->getUrl(
'checkout/cart'
);
}
$this->_redirect($url);
} else {
if ($configCartUrl) {
$cartUrl = $configCartUrl;
} else {
$cartUrl = 'checkout/cart';
}
//set before auth url. customer will be redirected to cart after successful login
$customerSession->setBeforeAuthUrl(
$this->quote->getStore()->getUrl($cartUrl)
);
//send customer to login page
$configLoginUrl = $this->quote->getStore()->getWebsite()
->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_LOGIN_URL
);
if ($configLoginUrl) {
$loginUrl = $configLoginUrl;
} else {
$loginUrl = 'customer/account/login';
}
$this->_redirect($this->quote->getStore()->getUrl($loginUrl));
}
} | [
"private",
"function",
"handleCustomerBasket",
"(",
")",
"{",
"/** @var \\Magento\\Customer\\Model\\Session $customerSession */",
"$",
"customerSession",
"=",
"$",
"this",
"->",
"customerSessionFactory",
"->",
"create",
"(",
")",
";",
"$",
"configCartUrl",
"=",
"$",
"th... | Process customer basket.
@return null | [
"Process",
"customer",
"basket",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Email/Getbasket.php#L93-L146 | train |
dotmailer/dotmailer-magento2-extension | Controller/Email/Getbasket.php | Getbasket.checkMissingAndAdd | private function checkMissingAndAdd()
{
/** @var \Magento\Checkout\Model\Session $checkoutSession */
$checkoutSession = $this->checkoutSession->create();
$currentQuote = $checkoutSession->getQuote();
if ($currentQuote->hasItems()) {
$currentSessionItems = $currentQuote->getAllItems();
$currentItemIds = [];
foreach ($currentSessionItems as $currentSessionItem) {
$currentItemIds[] = $currentSessionItem->getId();
}
/** @var \Magento\Quote\Model\Quote\Item $item */
foreach ($this->quote->getAllItems() as $item) {
if (!in_array($item->getId(), $currentItemIds)) {
$currentQuote->addItem($item);
}
}
$currentQuote->collectTotals();
$this->quoteResource->save($currentQuote);
}
} | php | private function checkMissingAndAdd()
{
/** @var \Magento\Checkout\Model\Session $checkoutSession */
$checkoutSession = $this->checkoutSession->create();
$currentQuote = $checkoutSession->getQuote();
if ($currentQuote->hasItems()) {
$currentSessionItems = $currentQuote->getAllItems();
$currentItemIds = [];
foreach ($currentSessionItems as $currentSessionItem) {
$currentItemIds[] = $currentSessionItem->getId();
}
/** @var \Magento\Quote\Model\Quote\Item $item */
foreach ($this->quote->getAllItems() as $item) {
if (!in_array($item->getId(), $currentItemIds)) {
$currentQuote->addItem($item);
}
}
$currentQuote->collectTotals();
$this->quoteResource->save($currentQuote);
}
} | [
"private",
"function",
"checkMissingAndAdd",
"(",
")",
"{",
"/** @var \\Magento\\Checkout\\Model\\Session $checkoutSession */",
"$",
"checkoutSession",
"=",
"$",
"this",
"->",
"checkoutSession",
"->",
"create",
"(",
")",
";",
"$",
"currentQuote",
"=",
"$",
"checkoutSess... | Check missing items from current quote and add.
@return null | [
"Check",
"missing",
"items",
"from",
"current",
"quote",
"and",
"add",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Email/Getbasket.php#L153-L176 | train |
dotmailer/dotmailer-magento2-extension | Controller/Email/Getbasket.php | Getbasket.handleGuestBasket | private function handleGuestBasket()
{
$configCartUrl = $this->quote->getStore()->getWebsite()->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_CART_URL
);
if ($configCartUrl) {
$url = $configCartUrl;
} else {
$url = 'checkout/cart';
}
$this->_redirect($this->quote->getStore()->getUrl($url));
} | php | private function handleGuestBasket()
{
$configCartUrl = $this->quote->getStore()->getWebsite()->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_CART_URL
);
if ($configCartUrl) {
$url = $configCartUrl;
} else {
$url = 'checkout/cart';
}
$this->_redirect($this->quote->getStore()->getUrl($url));
} | [
"private",
"function",
"handleGuestBasket",
"(",
")",
"{",
"$",
"configCartUrl",
"=",
"$",
"this",
"->",
"quote",
"->",
"getStore",
"(",
")",
"->",
"getWebsite",
"(",
")",
"->",
"getConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\"... | Process guest basket.
@return null | [
"Process",
"guest",
"basket",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Controller/Email/Getbasket.php#L183-L195 | train |
dotmailer/dotmailer-magento2-extension | Block/Review.php | Review.getOrder | public function getOrder()
{
$params = $this->getRequest()->getParams();
if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) {
$this->helper->log('Review no valid code is set');
return false;
}
$orderId = $this->_coreRegistry->registry('order_id');
$order = $this->_coreRegistry->registry('current_order');
if (! $orderId) {
$orderId = (int) $this->getRequest()->getParam('order_id');
if (! $orderId) {
return false;
}
$this->_coreRegistry->unregister('order_id'); // additional measure
$this->_coreRegistry->register('order_id', $orderId);
}
if (! $order) {
if (! $orderId) {
return false;
}
$order = $this->orderFactory->create();
$this->orderResource->load($order, $orderId);
$this->_coreRegistry->unregister('current_order'); // additional measure
$this->_coreRegistry->register('current_order', $order);
}
return $order;
} | php | public function getOrder()
{
$params = $this->getRequest()->getParams();
if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) {
$this->helper->log('Review no valid code is set');
return false;
}
$orderId = $this->_coreRegistry->registry('order_id');
$order = $this->_coreRegistry->registry('current_order');
if (! $orderId) {
$orderId = (int) $this->getRequest()->getParam('order_id');
if (! $orderId) {
return false;
}
$this->_coreRegistry->unregister('order_id'); // additional measure
$this->_coreRegistry->register('order_id', $orderId);
}
if (! $order) {
if (! $orderId) {
return false;
}
$order = $this->orderFactory->create();
$this->orderResource->load($order, $orderId);
$this->_coreRegistry->unregister('current_order'); // additional measure
$this->_coreRegistry->register('current_order', $order);
}
return $order;
} | [
"public",
"function",
"getOrder",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getParams",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'code'",
"]",
")",
"||",
"!",
"$",
"this",
"->",
... | Current Order.
@return bool|mixed | [
"Current",
"Order",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Review.php#L73-L102 | train |
dotmailer/dotmailer-magento2-extension | Block/Review.php | Review.filterItemsForReview | public function filterItemsForReview($items, $websiteId)
{
$order = $this->getOrder();
if (empty($items) || ! $order) {
return false;
}
//if customer is guest then no need to filter any items
if ($order->getCustomerIsGuest()) {
return $items;
}
if (!$this->helper->isNewProductOnly($websiteId)) {
return $items;
}
$customerId = $order->getCustomerId();
$items = $this->review->filterItemsForReview($items, $customerId, $order);
return $items;
} | php | public function filterItemsForReview($items, $websiteId)
{
$order = $this->getOrder();
if (empty($items) || ! $order) {
return false;
}
//if customer is guest then no need to filter any items
if ($order->getCustomerIsGuest()) {
return $items;
}
if (!$this->helper->isNewProductOnly($websiteId)) {
return $items;
}
$customerId = $order->getCustomerId();
$items = $this->review->filterItemsForReview($items, $customerId, $order);
return $items;
} | [
"public",
"function",
"filterItemsForReview",
"(",
"$",
"items",
",",
"$",
"websiteId",
")",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"items",
")",
"||",
"!",
"$",
"order",
")",
"{",
"retur... | Filter items for review. If a customer has already placed a review for a product then exclude the product.
@param array $items
@param int $websiteId
@return boolean|array | [
"Filter",
"items",
"for",
"review",
".",
"If",
"a",
"customer",
"has",
"already",
"placed",
"a",
"review",
"for",
"a",
"product",
"then",
"exclude",
"the",
"product",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Review.php#L129-L151 | train |
dotmailer/dotmailer-magento2-extension | Block/Roi.php | Roi.getProductNames | public function getProductNames()
{
$items = $this->getOrder()->getAllItems();
$productNames = [];
foreach ($items as $item) {
if ($item->getParentItemId() === null) {
$productNames[] = str_replace('"', ' ', $item->getName());
}
}
return json_encode($productNames);
} | php | public function getProductNames()
{
$items = $this->getOrder()->getAllItems();
$productNames = [];
foreach ($items as $item) {
if ($item->getParentItemId() === null) {
$productNames[] = str_replace('"', ' ', $item->getName());
}
}
return json_encode($productNames);
} | [
"public",
"function",
"getProductNames",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
"->",
"getAllItems",
"(",
")",
";",
"$",
"productNames",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"... | Get product names
@return string | [
"Get",
"product",
"names"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Roi.php#L71-L81 | train |
dotmailer/dotmailer-magento2-extension | Observer/Newsletter/RemoveContact.php | RemoveContact.execute | public function execute(\Magento\Framework\Event\Observer $observer)
{
$subscriber = $observer->getEvent()->getSubscriber();
$email = $subscriber->getEmail();
$websiteId = $this->storeManager->getStore($subscriber->getStoreId())
->getWebsiteId();
$apiEnabled = $this->helper->isEnabled($websiteId);
/*
* Remove contact.
*/
if ($apiEnabled) {
try {
//register in queue with importer
$this->importerFactory->create()->registerQueue(
\Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT,
$email,
\Dotdigitalgroup\Email\Model\Importer::MODE_CONTACT_DELETE,
$websiteId
);
$contactModel = $this->contactFactory->create()
->loadByCustomerEmail($email, $websiteId);
if ($contactModel->getId()) {
//remove contact
$this->contactResource->delete($contactModel);
}
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
}
return $this;
} | php | public function execute(\Magento\Framework\Event\Observer $observer)
{
$subscriber = $observer->getEvent()->getSubscriber();
$email = $subscriber->getEmail();
$websiteId = $this->storeManager->getStore($subscriber->getStoreId())
->getWebsiteId();
$apiEnabled = $this->helper->isEnabled($websiteId);
/*
* Remove contact.
*/
if ($apiEnabled) {
try {
//register in queue with importer
$this->importerFactory->create()->registerQueue(
\Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT,
$email,
\Dotdigitalgroup\Email\Model\Importer::MODE_CONTACT_DELETE,
$websiteId
);
$contactModel = $this->contactFactory->create()
->loadByCustomerEmail($email, $websiteId);
if ($contactModel->getId()) {
//remove contact
$this->contactResource->delete($contactModel);
}
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
}
return $this;
} | [
"public",
"function",
"execute",
"(",
"\\",
"Magento",
"\\",
"Framework",
"\\",
"Event",
"\\",
"Observer",
"$",
"observer",
")",
"{",
"$",
"subscriber",
"=",
"$",
"observer",
"->",
"getEvent",
"(",
")",
"->",
"getSubscriber",
"(",
")",
";",
"$",
"email",... | Remove contact from account
@param \Magento\Framework\Event\Observer $observer
@return $this | [
"Remove",
"contact",
"from",
"account"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Newsletter/RemoveContact.php#L66-L98 | train |
dotmailer/dotmailer-magento2-extension | Model/Connector/Product.php | Product.setProduct | public function setProduct($product)
{
$this->id = $product->getId();
$this->sku = $product->getSku();
$this->name = $product->getName();
$this->status = $this->statusFactory->create()
->getOptionText($product->getStatus());
$options = $this->visibilityFactory->create()
->getOptionArray();
$this->visibility = (string)$options[$product->getVisibility()];
$this->getMinPrices($product);
$this->url = $this->urlFinder->fetchFor($product);
$this->imagePath = $this->mediaConfigFactory->create()
->getMediaUrl($product->getSmallImage());
$this->stock = (float)number_format($this->getStockQty($product), 2, '.', '');
$shortDescription = $product->getShortDescription();
//limit short description
if ($this->stringUtils->strlen($shortDescription) > \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT) {
$shortDescription = mb_substr($shortDescription, 0, \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT);
}
$this->shortDescription = $shortDescription;
//category data
$count = 0;
$categoryCollection = $product->getCategoryCollection()
->addNameToResult();
foreach ($categoryCollection as $cat) {
$this->categories[$count]['Id'] = $cat->getId();
$this->categories[$count]['Name'] = $cat->getName();
++$count;
}
//website data
$count = 0;
$websiteIds = $product->getWebsiteIds();
foreach ($websiteIds as $websiteId) {
$website = $this->storeManager->getWebsite(
$websiteId
);
$this->websites[$count]['Id'] = $website->getId();
$this->websites[$count]['Name'] = $website->getName();
++$count;
}
$this->processProductOptions($product);
unset(
$this->itemFactory,
$this->mediaConfigFactory,
$this->visibilityFactory,
$this->statusFactory,
$this->helper,
$this->storeManager
);
return $this;
} | php | public function setProduct($product)
{
$this->id = $product->getId();
$this->sku = $product->getSku();
$this->name = $product->getName();
$this->status = $this->statusFactory->create()
->getOptionText($product->getStatus());
$options = $this->visibilityFactory->create()
->getOptionArray();
$this->visibility = (string)$options[$product->getVisibility()];
$this->getMinPrices($product);
$this->url = $this->urlFinder->fetchFor($product);
$this->imagePath = $this->mediaConfigFactory->create()
->getMediaUrl($product->getSmallImage());
$this->stock = (float)number_format($this->getStockQty($product), 2, '.', '');
$shortDescription = $product->getShortDescription();
//limit short description
if ($this->stringUtils->strlen($shortDescription) > \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT) {
$shortDescription = mb_substr($shortDescription, 0, \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT);
}
$this->shortDescription = $shortDescription;
//category data
$count = 0;
$categoryCollection = $product->getCategoryCollection()
->addNameToResult();
foreach ($categoryCollection as $cat) {
$this->categories[$count]['Id'] = $cat->getId();
$this->categories[$count]['Name'] = $cat->getName();
++$count;
}
//website data
$count = 0;
$websiteIds = $product->getWebsiteIds();
foreach ($websiteIds as $websiteId) {
$website = $this->storeManager->getWebsite(
$websiteId
);
$this->websites[$count]['Id'] = $website->getId();
$this->websites[$count]['Name'] = $website->getName();
++$count;
}
$this->processProductOptions($product);
unset(
$this->itemFactory,
$this->mediaConfigFactory,
$this->visibilityFactory,
$this->statusFactory,
$this->helper,
$this->storeManager
);
return $this;
} | [
"public",
"function",
"setProduct",
"(",
"$",
"product",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"product",
"->",
"getId",
"(",
")",
";",
"$",
"this",
"->",
"sku",
"=",
"$",
"product",
"->",
"getSku",
"(",
")",
";",
"$",
"this",
"->",
"name"... | Set the product data.
@param \Magento\Catalog\Model\Product $product
@return $this | [
"Set",
"the",
"product",
"data",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Product.php#L161-L225 | train |
dotmailer/dotmailer-magento2-extension | Model/Connector/Product.php | Product.getMinPrices | private function getMinPrices($product)
{
if ($product->getTypeId() == 'configurable') {
foreach ($product->getTypeInstance()->getUsedProducts($product) as $childProduct) {
$childPrices[] = $childProduct->getPrice();
if ($childProduct->getSpecialPrice() !== null) {
$childSpecialPrices[] = $childProduct->getSpecialPrice();
}
}
$this->price = isset($childPrices) ? min($childPrices) : null;
$this->specialPrice = isset($childSpecialPrices) ? min($childSpecialPrices) : null;
} elseif ($product->getTypeId() == 'bundle') {
$this->price = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
$this->specialPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
//if special price equals to price then its wrong.)
$this->specialPrice = ($this->specialPrice === $this->price) ? null : $this->specialPrice;
} elseif ($product->getTypeId() == 'grouped') {
foreach ($product->getTypeInstance()->getAssociatedProducts($product) as $childProduct) {
$childPrices[] = $childProduct->getPrice();
if ($childProduct->getSpecialPrice() !== null) {
$childSpecialPrices[] = $childProduct->getSpecialPrice();
}
}
$this->price = isset($childPrices) ? min($childPrices) : null;
$this->specialPrice = isset($childSpecialPrices) ? min($childSpecialPrices) : null;
} else {
$this->price = $product->getPrice();
$this->specialPrice = $product->getSpecialPrice();
}
$this->formatPriceValues();
} | php | private function getMinPrices($product)
{
if ($product->getTypeId() == 'configurable') {
foreach ($product->getTypeInstance()->getUsedProducts($product) as $childProduct) {
$childPrices[] = $childProduct->getPrice();
if ($childProduct->getSpecialPrice() !== null) {
$childSpecialPrices[] = $childProduct->getSpecialPrice();
}
}
$this->price = isset($childPrices) ? min($childPrices) : null;
$this->specialPrice = isset($childSpecialPrices) ? min($childSpecialPrices) : null;
} elseif ($product->getTypeId() == 'bundle') {
$this->price = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
$this->specialPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
//if special price equals to price then its wrong.)
$this->specialPrice = ($this->specialPrice === $this->price) ? null : $this->specialPrice;
} elseif ($product->getTypeId() == 'grouped') {
foreach ($product->getTypeInstance()->getAssociatedProducts($product) as $childProduct) {
$childPrices[] = $childProduct->getPrice();
if ($childProduct->getSpecialPrice() !== null) {
$childSpecialPrices[] = $childProduct->getSpecialPrice();
}
}
$this->price = isset($childPrices) ? min($childPrices) : null;
$this->specialPrice = isset($childSpecialPrices) ? min($childSpecialPrices) : null;
} else {
$this->price = $product->getPrice();
$this->specialPrice = $product->getSpecialPrice();
}
$this->formatPriceValues();
} | [
"private",
"function",
"getMinPrices",
"(",
"$",
"product",
")",
"{",
"if",
"(",
"$",
"product",
"->",
"getTypeId",
"(",
")",
"==",
"'configurable'",
")",
"{",
"foreach",
"(",
"$",
"product",
"->",
"getTypeInstance",
"(",
")",
"->",
"getUsedProducts",
"(",... | Set the Minimum Prices for Configurable and Bundle products.
@param \Magento\Catalog\Model\Product $product
@return null | [
"Set",
"the",
"Minimum",
"Prices",
"for",
"Configurable",
"and",
"Bundle",
"products",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Product.php#L357-L387 | train |
dotmailer/dotmailer-magento2-extension | Model/Connector/Product.php | Product.formatPriceValues | private function formatPriceValues()
{
$this->price = (float)number_format(
$this->price,
2,
'.',
''
);
$this->specialPrice = (float)number_format(
$this->specialPrice,
2,
'.',
''
);
} | php | private function formatPriceValues()
{
$this->price = (float)number_format(
$this->price,
2,
'.',
''
);
$this->specialPrice = (float)number_format(
$this->specialPrice,
2,
'.',
''
);
} | [
"private",
"function",
"formatPriceValues",
"(",
")",
"{",
"$",
"this",
"->",
"price",
"=",
"(",
"float",
")",
"number_format",
"(",
"$",
"this",
"->",
"price",
",",
"2",
",",
"'.'",
",",
"''",
")",
";",
"$",
"this",
"->",
"specialPrice",
"=",
"(",
... | Formats the price values.
@return null | [
"Formats",
"the",
"price",
"values",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Connector/Product.php#L395-L410 | train |
dotmailer/dotmailer-magento2-extension | Model/Config/Configuration/Catalogvisibility.php | Catalogvisibility.toOptionArray | public function toOptionArray()
{
$visibilities
= $this->productVisibility->getAllOptions();
$options[] = [
'label' => __('---- Default Option ----'),
'value' => '0',
];
foreach ($visibilities as $visibility) {
$options[] = [
'label' => $visibility['label'],
'value' => $visibility['value'],
];
}
return $options;
} | php | public function toOptionArray()
{
$visibilities
= $this->productVisibility->getAllOptions();
$options[] = [
'label' => __('---- Default Option ----'),
'value' => '0',
];
foreach ($visibilities as $visibility) {
$options[] = [
'label' => $visibility['label'],
'value' => $visibility['value'],
];
}
return $options;
} | [
"public",
"function",
"toOptionArray",
"(",
")",
"{",
"$",
"visibilities",
"=",
"$",
"this",
"->",
"productVisibility",
"->",
"getAllOptions",
"(",
")",
";",
"$",
"options",
"[",
"]",
"=",
"[",
"'label'",
"=>",
"__",
"(",
"'---- Default Option ----'",
")",
... | Return options.
@return mixed | [
"Return",
"options",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Config/Configuration/Catalogvisibility.php#L28-L43 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Studio.php | Studio.getLoginUserHtml | public function getLoginUserHtml()
{
// authorize or create token.
$token = $this->generateToken();
$baseUrl = $this->configFactory
->getLogUserUrl();
$loginuserUrl = $baseUrl . $token . '&suppressfooter=true';
return $loginuserUrl;
} | php | public function getLoginUserHtml()
{
// authorize or create token.
$token = $this->generateToken();
$baseUrl = $this->configFactory
->getLogUserUrl();
$loginuserUrl = $baseUrl . $token . '&suppressfooter=true';
return $loginuserUrl;
} | [
"public",
"function",
"getLoginUserHtml",
"(",
")",
"{",
"// authorize or create token.",
"$",
"token",
"=",
"$",
"this",
"->",
"generateToken",
"(",
")",
";",
"$",
"baseUrl",
"=",
"$",
"this",
"->",
"configFactory",
"->",
"getLogUserUrl",
"(",
")",
";",
"$"... | User login url.
@return string | [
"User",
"login",
"url",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Studio.php#L134-L144 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Studio.php | Studio.generateToken | public function generateToken()
{
$adminUser = $this->auth->getUser();
$refreshToken = $adminUser->getRefreshToken();
if ($refreshToken) {
$accessToken = $this->client->getAccessToken(
$this->configFactory->getTokenUrl(),
$this->buildUrlParams(
$this->helper->encryptor->decrypt($refreshToken)
)
);
if (is_string($accessToken)) {
return $accessToken;
}
}
return false;
} | php | public function generateToken()
{
$adminUser = $this->auth->getUser();
$refreshToken = $adminUser->getRefreshToken();
if ($refreshToken) {
$accessToken = $this->client->getAccessToken(
$this->configFactory->getTokenUrl(),
$this->buildUrlParams(
$this->helper->encryptor->decrypt($refreshToken)
)
);
if (is_string($accessToken)) {
return $accessToken;
}
}
return false;
} | [
"public",
"function",
"generateToken",
"(",
")",
"{",
"$",
"adminUser",
"=",
"$",
"this",
"->",
"auth",
"->",
"getUser",
"(",
")",
";",
"$",
"refreshToken",
"=",
"$",
"adminUser",
"->",
"getRefreshToken",
"(",
")",
";",
"if",
"(",
"$",
"refreshToken",
... | Generate new token and connect from the admin.
@return string | [
"Generate",
"new",
"token",
"and",
"connect",
"from",
"the",
"admin",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Studio.php#L151-L170 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Studio.php | Studio.buildUrlParams | public function buildUrlParams($refreshToken)
{
$params = 'client_id=' . $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
)
. '&client_secret=' . $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID
)
. '&refresh_token=' . $refreshToken . '&grant_type=refresh_token';
return $params;
} | php | public function buildUrlParams($refreshToken)
{
$params = 'client_id=' . $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
)
. '&client_secret=' . $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID
)
. '&refresh_token=' . $refreshToken . '&grant_type=refresh_token';
return $params;
} | [
"public",
"function",
"buildUrlParams",
"(",
"$",
"refreshToken",
")",
"{",
"$",
"params",
"=",
"'client_id='",
".",
"$",
"this",
"->",
"helper",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XM... | Build url param.
@param string $refreshToken
@return string | [
"Build",
"url",
"param",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Studio.php#L187-L198 | train |
dotmailer/dotmailer-magento2-extension | Model/AbandonedCart/ProgramEnrolment/Interval.php | Interval.getAbandonedCartProgramEnrolmentWindow | public function getAbandonedCartProgramEnrolmentWindow($storeId)
{
$fromTime = $this->dateTimeFactory->create(
[
'time' => 'now',
'timezone' => new \DateTimezone('UTC')
]
);
$minutes = (int) $this->helper->getScopeConfig()->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_LOSTBASKET_ENROL_TO_PROGRAM_INTERVAL,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
$interval = $this->dateIntervalFactory->create(
['interval_spec' => sprintf('PT%sM', $minutes)]
);
$fromTime->sub($interval);
$toTime = clone $fromTime;
$fromTime->sub($this->dateIntervalFactory->create(['interval_spec' => 'PT5M']));
return [
'from' => $fromTime->format('Y-m-d H:i:s'),
'to' => $toTime->format('Y-m-d H:i:s'),
'date' => true,
];
} | php | public function getAbandonedCartProgramEnrolmentWindow($storeId)
{
$fromTime = $this->dateTimeFactory->create(
[
'time' => 'now',
'timezone' => new \DateTimezone('UTC')
]
);
$minutes = (int) $this->helper->getScopeConfig()->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_LOSTBASKET_ENROL_TO_PROGRAM_INTERVAL,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
$interval = $this->dateIntervalFactory->create(
['interval_spec' => sprintf('PT%sM', $minutes)]
);
$fromTime->sub($interval);
$toTime = clone $fromTime;
$fromTime->sub($this->dateIntervalFactory->create(['interval_spec' => 'PT5M']));
return [
'from' => $fromTime->format('Y-m-d H:i:s'),
'to' => $toTime->format('Y-m-d H:i:s'),
'date' => true,
];
} | [
"public",
"function",
"getAbandonedCartProgramEnrolmentWindow",
"(",
"$",
"storeId",
")",
"{",
"$",
"fromTime",
"=",
"$",
"this",
"->",
"dateTimeFactory",
"->",
"create",
"(",
"[",
"'time'",
"=>",
"'now'",
",",
"'timezone'",
"=>",
"new",
"\\",
"DateTimezone",
... | Set time window for abandoned cart program enrolments
@param int $storeId
@return array
@throws \Exception | [
"Set",
"time",
"window",
"for",
"abandoned",
"cart",
"program",
"enrolments"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/AbandonedCart/ProgramEnrolment/Interval.php#L47-L75 | train |
dotmailer/dotmailer-magento2-extension | Model/Sync/Catalog/Exporter.php | Exporter.exportCatalog | public function exportCatalog($storeId, $limit)
{
$connectorProducts = [];
$products = $this->getProductsToExport($storeId, $limit);
foreach ($products as $product) {
$connectorProduct = $this->connectorProductFactory->create()
->setProduct($product);
$connectorProducts[$product->getId()] = $connectorProduct->expose();
}
return $connectorProducts;
} | php | public function exportCatalog($storeId, $limit)
{
$connectorProducts = [];
$products = $this->getProductsToExport($storeId, $limit);
foreach ($products as $product) {
$connectorProduct = $this->connectorProductFactory->create()
->setProduct($product);
$connectorProducts[$product->getId()] = $connectorProduct->expose();
}
return $connectorProducts;
} | [
"public",
"function",
"exportCatalog",
"(",
"$",
"storeId",
",",
"$",
"limit",
")",
"{",
"$",
"connectorProducts",
"=",
"[",
"]",
";",
"$",
"products",
"=",
"$",
"this",
"->",
"getProductsToExport",
"(",
"$",
"storeId",
",",
"$",
"limit",
")",
";",
"fo... | Export catalog.
@param string|int|null $storeId
@param string|int $limit
@return array | [
"Export",
"catalog",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Catalog/Exporter.php#L47-L59 | train |
dotmailer/dotmailer-magento2-extension | Model/Automation.php | Automation.newCustomerAutomation | public function newCustomerAutomation($customer)
{
$email = $customer->getEmail();
$websiteId = $customer->getWebsiteId();
$customerId = $customer->getId();
$store = $this->storeManager->getStore($customer->getStoreId());
$storeName = $store->getName();
try {
//Api is enabled
$apiEnabled = $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED,
$websiteId
);
//Automation enrolment
$programId = $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_CUSTOMER,
$websiteId
);
//new contact program mapped
if ($programId && $apiEnabled) {
//save automation type
$this->setEmail($email)
->setAutomationType(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_CUSTOMER)
->setEnrolmentStatus(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING)
->setTypeId($customerId)
->setWebsiteId($websiteId)
->setStoreName($storeName)
->setProgramId($programId);
$this->automationResource->save($this);
}
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
} | php | public function newCustomerAutomation($customer)
{
$email = $customer->getEmail();
$websiteId = $customer->getWebsiteId();
$customerId = $customer->getId();
$store = $this->storeManager->getStore($customer->getStoreId());
$storeName = $store->getName();
try {
//Api is enabled
$apiEnabled = $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED,
$websiteId
);
//Automation enrolment
$programId = $this->helper->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_CUSTOMER,
$websiteId
);
//new contact program mapped
if ($programId && $apiEnabled) {
//save automation type
$this->setEmail($email)
->setAutomationType(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_TYPE_NEW_CUSTOMER)
->setEnrolmentStatus(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING)
->setTypeId($customerId)
->setWebsiteId($websiteId)
->setStoreName($storeName)
->setProgramId($programId);
$this->automationResource->save($this);
}
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
} | [
"public",
"function",
"newCustomerAutomation",
"(",
"$",
"customer",
")",
"{",
"$",
"email",
"=",
"$",
"customer",
"->",
"getEmail",
"(",
")",
";",
"$",
"websiteId",
"=",
"$",
"customer",
"->",
"getWebsiteId",
"(",
")",
";",
"$",
"customerId",
"=",
"$",
... | New customer automation
@param \Magento\Customer\Model\Customer $customer
@return null | [
"New",
"customer",
"automation"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Automation.php#L97-L133 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.toJSON | public function toJSON($pretty = false)
{
if (!$pretty) {
return json_encode($this->expose());
} else {
return $this->prettyPrint(json_encode($this->expose()));
}
} | php | public function toJSON($pretty = false)
{
if (!$pretty) {
return json_encode($this->expose());
} else {
return $this->prettyPrint(json_encode($this->expose()));
}
} | [
"public",
"function",
"toJSON",
"(",
"$",
"pretty",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"pretty",
")",
"{",
"return",
"json_encode",
"(",
"$",
"this",
"->",
"expose",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"pr... | Returns the object as JSON.
@param bool $pretty
@return string | [
"Returns",
"the",
"object",
"as",
"JSON",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L171-L178 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.flush | public function flush()
{
$this->apiUsername = '';
$this->apiPassword = '';
$this->requestBody = null;
$this->requestLength = 0;
$this->verb = 'GET';
$this->responseBody = null;
$this->responseInfo = null;
return $this;
} | php | public function flush()
{
$this->apiUsername = '';
$this->apiPassword = '';
$this->requestBody = null;
$this->requestLength = 0;
$this->verb = 'GET';
$this->responseBody = null;
$this->responseInfo = null;
return $this;
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"$",
"this",
"->",
"apiUsername",
"=",
"''",
";",
"$",
"this",
"->",
"apiPassword",
"=",
"''",
";",
"$",
"this",
"->",
"requestBody",
"=",
"null",
";",
"$",
"this",
"->",
"requestLength",
"=",
"0",
";",
... | Reset the client.
@return $this | [
"Reset",
"the",
"client",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L195-L206 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.executePost | private function executePost($ch)
{
if (!is_string($this->requestBody)) {
$this->buildPostBody();
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
curl_setopt($ch, CURLOPT_POST, true);
$this->doExecute($ch);
} | php | private function executePost($ch)
{
if (!is_string($this->requestBody)) {
$this->buildPostBody();
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
curl_setopt($ch, CURLOPT_POST, true);
$this->doExecute($ch);
} | [
"private",
"function",
"executePost",
"(",
"$",
"ch",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"this",
"->",
"requestBody",
")",
")",
"{",
"$",
"this",
"->",
"buildPostBody",
"(",
")",
";",
"}",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_PO... | Execute post request.
@param mixed $ch
@return null | [
"Execute",
"post",
"request",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L310-L320 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.executePut | private function executePut($ch)
{
if (!is_string($this->requestBody)) {
$this->buildPostBody();
}
$this->requestLength = strlen($this->requestBody);
$fh = fopen('php://memory', 'rw');
fwrite($fh, $this->requestBody);
rewind($fh);
curl_setopt($ch, CURLOPT_INFILE, $fh);
curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
curl_setopt($ch, CURLOPT_PUT, true);
$this->doExecute($ch);
fclose($fh);
} | php | private function executePut($ch)
{
if (!is_string($this->requestBody)) {
$this->buildPostBody();
}
$this->requestLength = strlen($this->requestBody);
$fh = fopen('php://memory', 'rw');
fwrite($fh, $this->requestBody);
rewind($fh);
curl_setopt($ch, CURLOPT_INFILE, $fh);
curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
curl_setopt($ch, CURLOPT_PUT, true);
$this->doExecute($ch);
fclose($fh);
} | [
"private",
"function",
"executePut",
"(",
"$",
"ch",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"this",
"->",
"requestBody",
")",
")",
"{",
"$",
"this",
"->",
"buildPostBody",
"(",
")",
";",
"}",
"$",
"this",
"->",
"requestLength",
"=",
"strlen... | Execute put.
@param mixed $ch
@return null | [
"Execute",
"put",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L343-L361 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.setCurlOpts | private function setCurlOpts(&$ch)
{
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
[
'Accept: ' . $this->acceptType,
'Content-Type: application/json',
]
);
} | php | private function setCurlOpts(&$ch)
{
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
[
'Accept: ' . $this->acceptType,
'Content-Type: application/json',
]
);
} | [
"private",
"function",
"setCurlOpts",
"(",
"&",
"$",
"ch",
")",
"{",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_TIMEOUT",
",",
"60",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"this",
"->",
"url",
")",
";",
"curl_setopt",
... | Curl options.
@param mixed $ch
@return null | [
"Curl",
"options",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L411-L426 | train |
dotmailer/dotmailer-magento2-extension | Model/Apiconnector/Rest.php | Rest.setAuth | private function setAuth(&$ch)
{
if ($this->apiUsername !== null && $this->apiPassword !== null) {
curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_DIGEST);
curl_setopt(
$ch,
CURLOPT_USERPWD,
$this->apiUsername . ':' . $this->apiPassword
);
}
} | php | private function setAuth(&$ch)
{
if ($this->apiUsername !== null && $this->apiPassword !== null) {
curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_DIGEST);
curl_setopt(
$ch,
CURLOPT_USERPWD,
$this->apiUsername . ':' . $this->apiPassword
);
}
} | [
"private",
"function",
"setAuth",
"(",
"&",
"$",
"ch",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"apiUsername",
"!==",
"null",
"&&",
"$",
"this",
"->",
"apiPassword",
"!==",
"null",
")",
"{",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLAUTH_BASIC",
",",
"... | Basic auth.
@param mixed $ch
@return null | [
"Basic",
"auth",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Apiconnector/Rest.php#L435-L445 | train |
dotmailer/dotmailer-magento2-extension | Observer/Customer/RegisterWishlist.php | RegisterWishlist.registerWishlist | private function registerWishlist($wishlist, $itemCount, $customer)
{
try {
$emailWishlist = $this->wishlistFactory->create();
//if wishlist exist not to save again
if (! $emailWishlist->getWishlist($wishlist->getWishlistId())) {
$storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
$emailWishlist->setWishlistId($wishlist->getWishlistId())
->setCustomerId($wishlist->getCustomerId())
->setStoreId($customer->getStoreId())
->setItemCount($itemCount);
$this->emailWishlistResource->save($emailWishlist);
$this->registerWithAutomation($wishlist, $customer, $storeName);
}
} catch (\Exception $e) {
$this->helper->error((string)$e, []);
}
} | php | private function registerWishlist($wishlist, $itemCount, $customer)
{
try {
$emailWishlist = $this->wishlistFactory->create();
//if wishlist exist not to save again
if (! $emailWishlist->getWishlist($wishlist->getWishlistId())) {
$storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
$emailWishlist->setWishlistId($wishlist->getWishlistId())
->setCustomerId($wishlist->getCustomerId())
->setStoreId($customer->getStoreId())
->setItemCount($itemCount);
$this->emailWishlistResource->save($emailWishlist);
$this->registerWithAutomation($wishlist, $customer, $storeName);
}
} catch (\Exception $e) {
$this->helper->error((string)$e, []);
}
} | [
"private",
"function",
"registerWishlist",
"(",
"$",
"wishlist",
",",
"$",
"itemCount",
",",
"$",
"customer",
")",
"{",
"try",
"{",
"$",
"emailWishlist",
"=",
"$",
"this",
"->",
"wishlistFactory",
"->",
"create",
"(",
")",
";",
"//if wishlist exist not to save... | Register new wishlist.
@param \Dotdigitalgroup\Email\Model\Wishlist $wishlist
@param int $itemCount
@param \Magento\Customer\Api\Data\CustomerInterface $customer | [
"Register",
"new",
"wishlist",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Customer/RegisterWishlist.php#L120-L139 | train |
dotmailer/dotmailer-magento2-extension | Model/AbandonedCart/ProgramEnrolment/Rules.php | Rules.apply | public function apply($collection, $storeId)
{
$ruleModel = $this->rulesFactory->create();
$websiteId = $this->helper->storeManager->getStore($storeId)
->getWebsiteId();
return $ruleModel->process(
$collection,
\Dotdigitalgroup\Email\Model\Rules::ABANDONED,
$websiteId
);
} | php | public function apply($collection, $storeId)
{
$ruleModel = $this->rulesFactory->create();
$websiteId = $this->helper->storeManager->getStore($storeId)
->getWebsiteId();
return $ruleModel->process(
$collection,
\Dotdigitalgroup\Email\Model\Rules::ABANDONED,
$websiteId
);
} | [
"public",
"function",
"apply",
"(",
"$",
"collection",
",",
"$",
"storeId",
")",
"{",
"$",
"ruleModel",
"=",
"$",
"this",
"->",
"rulesFactory",
"->",
"create",
"(",
")",
";",
"$",
"websiteId",
"=",
"$",
"this",
"->",
"helper",
"->",
"storeManager",
"->... | Apply rules to sales collection
@param \Magento\Quote\Model\ResourceModel\Quote\Collection|\Magento\Sales\Model\ResourceModel\Order\Collection $collection
@param int $storeId
@return \Magento\Quote\Model\ResourceModel\Quote\Collection|\Magento\Sales\Model\ResourceModel\Order\Collection
@throws \Magento\Framework\Exception\NoSuchEntityException | [
"Apply",
"rules",
"to",
"sales",
"collection"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/AbandonedCart/ProgramEnrolment/Rules.php#L40-L50 | train |
dotmailer/dotmailer-magento2-extension | Observer/Customer/RemoveWishlistItem.php | RemoveWishlistItem.execute | public function execute(\Magento\Framework\Event\Observer $observer)
{
try {
$wishlistItem = $observer->getEvent()->getItem();
$emailWishlist = $this->emailWishlistCollection->create()
->getWishlistById($wishlistItem->getWishlistId());
if ($emailWishlist) {
$count = $emailWishlist->getItemCount();
//update wishlist count and set to modified
$emailWishlist->setItemCount(--$count);
$emailWishlist->setWishlistModified(1);
$this->emailWishlistResource->save($emailWishlist);
}
} catch (\Exception $e) {
$this->helper->log((string)$e, []);
}
} | php | public function execute(\Magento\Framework\Event\Observer $observer)
{
try {
$wishlistItem = $observer->getEvent()->getItem();
$emailWishlist = $this->emailWishlistCollection->create()
->getWishlistById($wishlistItem->getWishlistId());
if ($emailWishlist) {
$count = $emailWishlist->getItemCount();
//update wishlist count and set to modified
$emailWishlist->setItemCount(--$count);
$emailWishlist->setWishlistModified(1);
$this->emailWishlistResource->save($emailWishlist);
}
} catch (\Exception $e) {
$this->helper->log((string)$e, []);
}
} | [
"public",
"function",
"execute",
"(",
"\\",
"Magento",
"\\",
"Framework",
"\\",
"Event",
"\\",
"Observer",
"$",
"observer",
")",
"{",
"try",
"{",
"$",
"wishlistItem",
"=",
"$",
"observer",
"->",
"getEvent",
"(",
")",
"->",
"getItem",
"(",
")",
";",
"$"... | Delete wishlist item event.
@param \Magento\Framework\Event\Observer $observer | [
"Delete",
"wishlist",
"item",
"event",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Observer/Customer/RemoveWishlistItem.php#L45-L62 | train |
dotmailer/dotmailer-magento2-extension | Model/ResourceModel/Rules.php | Rules.joinTablesOnCollectionByType | public function joinTablesOnCollectionByType($collection, $type)
{
if ($type == \Dotdigitalgroup\Email\Model\Rules::ABANDONED) {
$collection->getSelect()
->joinLeft(
['quote_address' => $this->getTable('quote_address')],
'main_table.entity_id = quote_address.quote_id',
['shipping_method', 'country_id', 'city', 'region_id']
)->joinLeft(
['quote_payment' => $this->getTable('quote_payment')],
'main_table.entity_id = quote_payment.quote_id',
['method']
)->where('address_type = ?', 'shipping');
} elseif ($type == \Dotdigitalgroup\Email\Model\Rules::REVIEW) {
$collection->getSelect()
->join(
['order_address' => $this->getTable('sales_order_address')],
'main_table.entity_id = order_address.parent_id',
['country_id', 'city', 'region_id']
)->join(
['order_payment' => $this->getTable('sales_order_payment')],
'main_table.entity_id = order_payment.parent_id',
['method']
)->where('order_address.address_type = ?', 'shipping');
}
return $collection;
} | php | public function joinTablesOnCollectionByType($collection, $type)
{
if ($type == \Dotdigitalgroup\Email\Model\Rules::ABANDONED) {
$collection->getSelect()
->joinLeft(
['quote_address' => $this->getTable('quote_address')],
'main_table.entity_id = quote_address.quote_id',
['shipping_method', 'country_id', 'city', 'region_id']
)->joinLeft(
['quote_payment' => $this->getTable('quote_payment')],
'main_table.entity_id = quote_payment.quote_id',
['method']
)->where('address_type = ?', 'shipping');
} elseif ($type == \Dotdigitalgroup\Email\Model\Rules::REVIEW) {
$collection->getSelect()
->join(
['order_address' => $this->getTable('sales_order_address')],
'main_table.entity_id = order_address.parent_id',
['country_id', 'city', 'region_id']
)->join(
['order_payment' => $this->getTable('sales_order_payment')],
'main_table.entity_id = order_payment.parent_id',
['method']
)->where('order_address.address_type = ?', 'shipping');
}
return $collection;
} | [
"public",
"function",
"joinTablesOnCollectionByType",
"(",
"$",
"collection",
",",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Model",
"\\",
"Rules",
"::",
"ABANDONED",
")",
"{",
"$",
"collection",
"-... | Join tables on collection by type.
@param Collection $collection
@param string $type
@return Collection | [
"Join",
"tables",
"on",
"collection",
"by",
"type",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Rules.php#L60-L87 | train |
dotmailer/dotmailer-magento2-extension | Model/Sync/Contact/Bulk.php | Bulk._getAddressBook | private function _getAddressBook($importType, $websiteId)
{
switch ($importType) {
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT:
$addressBook = $this->helper->getCustomerAddressBook(
$websiteId
);
break;
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBERS:
$addressBook = $this->helper->getSubscriberAddressBook(
$websiteId
);
break;
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST:
$addressBook = $this->helper->getGuestAddressBook($websiteId);
break;
default:
$addressBook = '';
}
return $addressBook;
} | php | private function _getAddressBook($importType, $websiteId)
{
switch ($importType) {
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT:
$addressBook = $this->helper->getCustomerAddressBook(
$websiteId
);
break;
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBERS:
$addressBook = $this->helper->getSubscriberAddressBook(
$websiteId
);
break;
case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST:
$addressBook = $this->helper->getGuestAddressBook($websiteId);
break;
default:
$addressBook = '';
}
return $addressBook;
} | [
"private",
"function",
"_getAddressBook",
"(",
"$",
"importType",
",",
"$",
"websiteId",
")",
"{",
"switch",
"(",
"$",
"importType",
")",
"{",
"case",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Model",
"\\",
"Importer",
"::",
"IMPORT_TYPE_CONTACT",
":",
... | Get addressbook by import type.
@param string $importType
@param int $websiteId
@return string | [
"Get",
"addressbook",
"by",
"import",
"type",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Contact/Bulk.php#L100-L121 | train |
dotmailer/dotmailer-magento2-extension | Model/AbandonedCart/ProgramEnrolment/Enroller.php | Enroller.getStoreQuotesForGuestsAndCustomers | private function getStoreQuotesForGuestsAndCustomers($storeId, $updated)
{
$salesCollection = $this->orderCollection->create()
->getStoreQuotesForGuestsAndCustomers($storeId, $updated);
$this->rules->apply($salesCollection, $storeId);
return $salesCollection;
} | php | private function getStoreQuotesForGuestsAndCustomers($storeId, $updated)
{
$salesCollection = $this->orderCollection->create()
->getStoreQuotesForGuestsAndCustomers($storeId, $updated);
$this->rules->apply($salesCollection, $storeId);
return $salesCollection;
} | [
"private",
"function",
"getStoreQuotesForGuestsAndCustomers",
"(",
"$",
"storeId",
",",
"$",
"updated",
")",
"{",
"$",
"salesCollection",
"=",
"$",
"this",
"->",
"orderCollection",
"->",
"create",
"(",
")",
"->",
"getStoreQuotesForGuestsAndCustomers",
"(",
"$",
"s... | Retrieve store quotes
@param int $storeId
@param array $updated
@return \Magento\Quote\Model\ResourceModel\Quote\Collection|\Magento\Sales\Model\ResourceModel\Order\Collection | [
"Retrieve",
"store",
"quotes"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/AbandonedCart/ProgramEnrolment/Enroller.php#L109-L117 | train |
dotmailer/dotmailer-magento2-extension | Plugin/CustomerManagementPlugin.php | CustomerManagementPlugin.afterCreate | public function afterCreate(\Magento\Sales\Api\OrderCustomerManagementInterface $subject, $customer)
{
//New Automation enrolment to queue
$this->automation->newCustomerAutomation($customer);
return $customer;
} | php | public function afterCreate(\Magento\Sales\Api\OrderCustomerManagementInterface $subject, $customer)
{
//New Automation enrolment to queue
$this->automation->newCustomerAutomation($customer);
return $customer;
} | [
"public",
"function",
"afterCreate",
"(",
"\\",
"Magento",
"\\",
"Sales",
"\\",
"Api",
"\\",
"OrderCustomerManagementInterface",
"$",
"subject",
",",
"$",
"customer",
")",
"{",
"//New Automation enrolment to queue",
"$",
"this",
"->",
"automation",
"->",
"newCustome... | Plugin for create function.
@param \Magento\Sales\Api\OrderCustomerManagementInterface $subject
@param mixed $customer
@return mixed
@SuppressWarnings(PHPMD.UnusedFormalParameter) | [
"Plugin",
"for",
"create",
"function",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Plugin/CustomerManagementPlugin.php#L34-L40 | train |
dotmailer/dotmailer-magento2-extension | Block/Coupon.php | Coupon.generateCoupon | public function generateCoupon()
{
$params = $this->getRequest()->getParams();
//check for param code and id
if (! isset($params['code']) ||
! $this->helper->isCodeValid($params['code'])
) {
return false;
}
$priceRuleId = (int) $params['id'];
$expireDate = false;
if (isset($params['expire_days']) && is_numeric($params['expire_days']) && $params['expire_days'] > 0) {
$days = (int) $params['expire_days'];
$expireDate = $this->_localeDate->date()
->add($this->dateIntervalFactory->create(['interval_spec' => sprintf('P%sD', $days)]));
}
return $this->dotmailerCouponGenerator->generateCoupon($priceRuleId, $expireDate);
} | php | public function generateCoupon()
{
$params = $this->getRequest()->getParams();
//check for param code and id
if (! isset($params['code']) ||
! $this->helper->isCodeValid($params['code'])
) {
return false;
}
$priceRuleId = (int) $params['id'];
$expireDate = false;
if (isset($params['expire_days']) && is_numeric($params['expire_days']) && $params['expire_days'] > 0) {
$days = (int) $params['expire_days'];
$expireDate = $this->_localeDate->date()
->add($this->dateIntervalFactory->create(['interval_spec' => sprintf('P%sD', $days)]));
}
return $this->dotmailerCouponGenerator->generateCoupon($priceRuleId, $expireDate);
} | [
"public",
"function",
"generateCoupon",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getParams",
"(",
")",
";",
"//check for param code and id",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'code'",
"]",
")",... | Generates the coupon code based on the code id.
@return bool
@throws \Magento\Framework\Exception\LocalizedException | [
"Generates",
"the",
"coupon",
"code",
"based",
"on",
"the",
"code",
"id",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Coupon.php#L70-L90 | train |
dotmailer/dotmailer-magento2-extension | Model/Review.php | Review.beforeSave | public function beforeSave()
{
parent::beforeSave();
if ($this->isObjectNew() && !$this->getCreatedAt()) {
$this->setCreatedAt($this->dateTime->formatDate(true));
}
$this->setUpdatedAt($this->dateTime->formatDate(true));
return $this;
} | php | public function beforeSave()
{
parent::beforeSave();
if ($this->isObjectNew() && !$this->getCreatedAt()) {
$this->setCreatedAt($this->dateTime->formatDate(true));
}
$this->setUpdatedAt($this->dateTime->formatDate(true));
return $this;
} | [
"public",
"function",
"beforeSave",
"(",
")",
"{",
"parent",
"::",
"beforeSave",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isObjectNew",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"getCreatedAt",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setCreatedAt"... | Prepare data to be saved to database.
@return $this | [
"Prepare",
"data",
"to",
"be",
"saved",
"to",
"database",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Review.php#L58-L67 | train |
dotmailer/dotmailer-magento2-extension | Model/Sync/Catalog.php | Catalog.sync | public function sync()
{
$response = ['success' => true, 'message' => 'Done.'];
$this->start = microtime(true);
$countProducts = $this->syncCatalog();
if ($countProducts) {
$message = '----------- Catalog sync ----------- : ' .
gmdate('H:i:s', microtime(true) - $this->start) .
', Total synced = ' . $countProducts;
$this->helper->log($message);
$response['message'] = $message;
}
return $response;
} | php | public function sync()
{
$response = ['success' => true, 'message' => 'Done.'];
$this->start = microtime(true);
$countProducts = $this->syncCatalog();
if ($countProducts) {
$message = '----------- Catalog sync ----------- : ' .
gmdate('H:i:s', microtime(true) - $this->start) .
', Total synced = ' . $countProducts;
$this->helper->log($message);
$response['message'] = $message;
}
return $response;
} | [
"public",
"function",
"sync",
"(",
")",
"{",
"$",
"response",
"=",
"[",
"'success'",
"=>",
"true",
",",
"'message'",
"=>",
"'Done.'",
"]",
";",
"$",
"this",
"->",
"start",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"countProducts",
"=",
"$",
"this... | Catalog sync.
@return array | [
"Catalog",
"sync",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Catalog.php#L52-L68 | train |
dotmailer/dotmailer-magento2-extension | Model/Sync/Catalog.php | Catalog.syncCatalog | public function syncCatalog()
{
try {
//remove product with product id set and no product
$this->catalogResourceFactory->create()
->removeOrphanProducts();
return $this->catalogSyncFactory->create()->sync();
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
} | php | public function syncCatalog()
{
try {
//remove product with product id set and no product
$this->catalogResourceFactory->create()
->removeOrphanProducts();
return $this->catalogSyncFactory->create()->sync();
} catch (\Exception $e) {
$this->helper->debug((string)$e, []);
}
} | [
"public",
"function",
"syncCatalog",
"(",
")",
"{",
"try",
"{",
"//remove product with product id set and no product",
"$",
"this",
"->",
"catalogResourceFactory",
"->",
"create",
"(",
")",
"->",
"removeOrphanProducts",
"(",
")",
";",
"return",
"$",
"this",
"->",
... | Sync product catalogs
@return int | [
"Sync",
"product",
"catalogs"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sync/Catalog.php#L75-L87 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Config/Rules/Customdatafields.php | Customdatafields.renderCellTemplate | public function renderCellTemplate($columnName)
{
if ($columnName == 'attribute') {
return $this->_getAttributeRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->getElement()->getValues()
)
->toHtml();
} elseif ($columnName == 'conditions') {
return $this->_getConditionsRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->condition->toOptionArray()
)
->toHtml();
} elseif ($columnName == 'cvalue') {
return $this->_getValueRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->value->toOptionArray()
)
->toHtml();
}
return parent::renderCellTemplate($columnName);
} | php | public function renderCellTemplate($columnName)
{
if ($columnName == 'attribute') {
return $this->_getAttributeRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->getElement()->getValues()
)
->toHtml();
} elseif ($columnName == 'conditions') {
return $this->_getConditionsRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->condition->toOptionArray()
)
->toHtml();
} elseif ($columnName == 'cvalue') {
return $this->_getValueRenderer()
->setName($this->_getCellInputElementName($columnName))
->setTitle($columnName)
->setClass($this->className)
->setOptions(
$this->value->toOptionArray()
)
->toHtml();
}
return parent::renderCellTemplate($columnName);
} | [
"public",
"function",
"renderCellTemplate",
"(",
"$",
"columnName",
")",
"{",
"if",
"(",
"$",
"columnName",
"==",
"'attribute'",
")",
"{",
"return",
"$",
"this",
"->",
"_getAttributeRenderer",
"(",
")",
"->",
"setName",
"(",
"$",
"this",
"->",
"_getCellInput... | render cell template.
@param string $columnName
@return string | [
"render",
"cell",
"template",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Config/Rules/Customdatafields.php#L99-L131 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Config/Rules/Customdatafields.php | Customdatafields._getAttributeRenderer | private function _getAttributeRenderer()
{
if (!$this->getAttributeRenderer) {
$this->getAttributeRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getAttributeRenderer;
} | php | private function _getAttributeRenderer()
{
if (!$this->getAttributeRenderer) {
$this->getAttributeRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getAttributeRenderer;
} | [
"private",
"function",
"_getAttributeRenderer",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getAttributeRenderer",
")",
"{",
"$",
"this",
"->",
"getAttributeRenderer",
"=",
"$",
"this",
"->",
"getLayout",
"(",
")",
"->",
"createBlock",
"(",
"\\",
"D... | Get rendered for attribute field.
@return \Magento\Framework\View\Element\BlockInterface | [
"Get",
"rendered",
"for",
"attribute",
"field",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Config/Rules/Customdatafields.php#L163-L175 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Config/Rules/Customdatafields.php | Customdatafields._getConditionsRenderer | private function _getConditionsRenderer()
{
if (!$this->getConditionsRenderer) {
$this->getConditionsRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getConditionsRenderer;
} | php | private function _getConditionsRenderer()
{
if (!$this->getConditionsRenderer) {
$this->getConditionsRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getConditionsRenderer;
} | [
"private",
"function",
"_getConditionsRenderer",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getConditionsRenderer",
")",
"{",
"$",
"this",
"->",
"getConditionsRenderer",
"=",
"$",
"this",
"->",
"getLayout",
"(",
")",
"->",
"createBlock",
"(",
"\\",
... | Get renderer for conditions field.
@return \Magento\Framework\View\Element\BlockInterface | [
"Get",
"renderer",
"for",
"conditions",
"field",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Config/Rules/Customdatafields.php#L182-L194 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Config/Rules/Customdatafields.php | Customdatafields._getValueRenderer | private function _getValueRenderer()
{
if (!$this->getValueRenderer) {
$this->getValueRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getValueRenderer;
} | php | private function _getValueRenderer()
{
if (!$this->getValueRenderer) {
$this->getValueRenderer = $this->getLayout()
->createBlock(
\Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->getValueRenderer;
} | [
"private",
"function",
"_getValueRenderer",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getValueRenderer",
")",
"{",
"$",
"this",
"->",
"getValueRenderer",
"=",
"$",
"this",
"->",
"getLayout",
"(",
")",
"->",
"createBlock",
"(",
"\\",
"Dotdigitalgro... | Get renderer for value field.
@return \Magento\Framework\View\Element\BlockInterface | [
"Get",
"renderer",
"for",
"value",
"field",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Config/Rules/Customdatafields.php#L201-L213 | train |
dotmailer/dotmailer-magento2-extension | Model/ResourceModel/Wishlist/Collection.php | Collection.getWishlistById | public function getWishlistById($wishListId)
{
$collection = $this->addFieldToFilter('wishlist_id', $wishListId)
->setPageSize(1);
if ($collection->getSize()) {
return $collection->getFirstItem();
}
return false;
} | php | public function getWishlistById($wishListId)
{
$collection = $this->addFieldToFilter('wishlist_id', $wishListId)
->setPageSize(1);
if ($collection->getSize()) {
return $collection->getFirstItem();
}
return false;
} | [
"public",
"function",
"getWishlistById",
"(",
"$",
"wishListId",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"addFieldToFilter",
"(",
"'wishlist_id'",
",",
"$",
"wishListId",
")",
"->",
"setPageSize",
"(",
"1",
")",
";",
"if",
"(",
"$",
"collectio... | Get the collection first item.
@param int $wishListId
@return bool|\Magento\Framework\DataObject | [
"Get",
"the",
"collection",
"first",
"item",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Wishlist/Collection.php#L45-L55 | train |
dotmailer/dotmailer-magento2-extension | Setup/Recurring.php | Recurring.checkAndCreateAbandonedCart | private function checkAndCreateAbandonedCart($setup, $context)
{
$connection = $setup->getConnection();
$abandonedCartTableName = $setup->getTable(Schema::EMAIL_ABANDONED_CART_TABLE);
if (version_compare($context->getVersion(), '2.3.8', '>') &&
! $connection->isTableExists($abandonedCartTableName)
) {
$this->shared->createAbandonedCartTable($setup, $abandonedCartTableName);
}
} | php | private function checkAndCreateAbandonedCart($setup, $context)
{
$connection = $setup->getConnection();
$abandonedCartTableName = $setup->getTable(Schema::EMAIL_ABANDONED_CART_TABLE);
if (version_compare($context->getVersion(), '2.3.8', '>') &&
! $connection->isTableExists($abandonedCartTableName)
) {
$this->shared->createAbandonedCartTable($setup, $abandonedCartTableName);
}
} | [
"private",
"function",
"checkAndCreateAbandonedCart",
"(",
"$",
"setup",
",",
"$",
"context",
")",
"{",
"$",
"connection",
"=",
"$",
"setup",
"->",
"getConnection",
"(",
")",
";",
"$",
"abandonedCartTableName",
"=",
"$",
"setup",
"->",
"getTable",
"(",
"Sche... | Create table for abandoned carts if doesn't exists between two versions.
@param SchemaSetupInterface $setup
@param ModuleContextInterface $context | [
"Create",
"table",
"for",
"abandoned",
"carts",
"if",
"doesn",
"t",
"exists",
"between",
"two",
"versions",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Setup/Recurring.php#L66-L76 | train |
dotmailer/dotmailer-magento2-extension | Block/Adminhtml/Config/Developer/Connect.php | Connect.getAuthoriseUrl | public function getAuthoriseUrl()
{
$clientId = $this->_scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
);
//callback uri if not set custom
$redirectUri = $this->helper->getRedirectUri();
$redirectUri .= 'connector/email/callback';
$adminUser = $this->auth->getUser();
//query params
$params = [
'redirect_uri' => $redirectUri,
'scope' => 'Account',
'state' => $adminUser->getId(),
'response_type' => 'code',
];
$authorizeBaseUrl = $this->configHelper
->getAuthorizeLink();
$url = $authorizeBaseUrl . http_build_query($params)
. '&client_id=' . $clientId;
return $url;
} | php | public function getAuthoriseUrl()
{
$clientId = $this->_scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
);
//callback uri if not set custom
$redirectUri = $this->helper->getRedirectUri();
$redirectUri .= 'connector/email/callback';
$adminUser = $this->auth->getUser();
//query params
$params = [
'redirect_uri' => $redirectUri,
'scope' => 'Account',
'state' => $adminUser->getId(),
'response_type' => 'code',
];
$authorizeBaseUrl = $this->configHelper
->getAuthorizeLink();
$url = $authorizeBaseUrl . http_build_query($params)
. '&client_id=' . $clientId;
return $url;
} | [
"public",
"function",
"getAuthoriseUrl",
"(",
")",
"{",
"$",
"clientId",
"=",
"$",
"this",
"->",
"_scopeConfig",
"->",
"getValue",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_CLIENT_ID",
")",
";",
"//c... | Autorisation url for OAUTH.
@return string | [
"Autorisation",
"url",
"for",
"OAUTH",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Block/Adminhtml/Config/Developer/Connect.php#L126-L152 | train |
dotmailer/dotmailer-magento2-extension | Model/Catalog/UrlFinder.php | UrlFinder.fetchFor | public function fetchFor($product)
{
$product = $this->getScopedProduct($product);
if ($product->getVisibility() == \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE &&
$product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE
) {
$parentId = $this->getFirstParentId($product);
if (isset($parentId)) {
/** @var \Magento\Catalog\Model\Product $parentProduct */
$parentProduct = $this->productRepository->getById($parentId, false, $product->getStoreId());
return $parentProduct->getProductUrl();
}
}
return $product->getProductUrl();
} | php | public function fetchFor($product)
{
$product = $this->getScopedProduct($product);
if ($product->getVisibility() == \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE &&
$product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE
) {
$parentId = $this->getFirstParentId($product);
if (isset($parentId)) {
/** @var \Magento\Catalog\Model\Product $parentProduct */
$parentProduct = $this->productRepository->getById($parentId, false, $product->getStoreId());
return $parentProduct->getProductUrl();
}
}
return $product->getProductUrl();
} | [
"public",
"function",
"fetchFor",
"(",
"$",
"product",
")",
"{",
"$",
"product",
"=",
"$",
"this",
"->",
"getScopedProduct",
"(",
"$",
"product",
")",
";",
"if",
"(",
"$",
"product",
"->",
"getVisibility",
"(",
")",
"==",
"\\",
"Magento",
"\\",
"Catalo... | Fetch a URL for a product depending on its visibility and type.
@param \Magento\Catalog\Model\Product $product
@return string
@throws \Magento\Framework\Exception\NoSuchEntityException | [
"Fetch",
"a",
"URL",
"for",
"a",
"product",
"depending",
"on",
"its",
"visibility",
"and",
"type",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Catalog/UrlFinder.php#L63-L78 | train |
dotmailer/dotmailer-magento2-extension | Model/Catalog/UrlFinder.php | UrlFinder.getScopedProduct | private function getScopedProduct($product)
{
if (!in_array($product->getStoreId(), $product->getStoreIds())) {
$productInWebsites = $product->getWebsiteIds();
$firstWebsite = $this->storeManager->getWebsite($productInWebsites[0]);
$storeId = (int) $firstWebsite->getDefaultGroup()->getDefaultStoreId();
return $this->productRepository->getById($product->getId(), false, $storeId);
}
return $product;
} | php | private function getScopedProduct($product)
{
if (!in_array($product->getStoreId(), $product->getStoreIds())) {
$productInWebsites = $product->getWebsiteIds();
$firstWebsite = $this->storeManager->getWebsite($productInWebsites[0]);
$storeId = (int) $firstWebsite->getDefaultGroup()->getDefaultStoreId();
return $this->productRepository->getById($product->getId(), false, $storeId);
}
return $product;
} | [
"private",
"function",
"getScopedProduct",
"(",
"$",
"product",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"product",
"->",
"getStoreId",
"(",
")",
",",
"$",
"product",
"->",
"getStoreIds",
"(",
")",
")",
")",
"{",
"$",
"productInWebsites",
"=",
"... | In default-level catalog sync, the supplied Product's store ID can be 1 even though the product is not in store 1
This method finds the default store of the first website the product belongs to, and uses that to get a new product.
@param \Magento\Catalog\Model\Product $product
@return \Magento\Catalog\Api\Data\ProductInterface|\Magento\Catalog\Model\Product
@throws \Magento\Framework\Exception\LocalizedException
@throws \Magento\Framework\Exception\NoSuchEntityException | [
"In",
"default",
"-",
"level",
"catalog",
"sync",
"the",
"supplied",
"Product",
"s",
"store",
"ID",
"can",
"be",
"1",
"even",
"though",
"the",
"product",
"is",
"not",
"in",
"store",
"1",
"This",
"method",
"finds",
"the",
"default",
"store",
"of",
"the",
... | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Catalog/UrlFinder.php#L117-L129 | train |
dotmailer/dotmailer-magento2-extension | Model/ResourceModel/Wishlist.php | Wishlist.resetWishlists | public function resetWishlists($from = null, $to = null)
{
$conn = $this->getConnection();
if ($from && $to) {
$where = [
'created_at >= ?' => $from . ' 00:00:00',
'created_at <= ?' => $to . ' 23:59:59',
'wishlist_imported is ?' => new \Zend_Db_Expr('not null')
];
} else {
$where = $conn->quoteInto(
'wishlist_imported is ?',
new \Zend_Db_Expr('not null')
);
}
$num = $conn->update(
$this->getTable(Schema::EMAIL_WISHLIST_TABLE),
[
'wishlist_imported' => new \Zend_Db_Expr('null'),
'wishlist_modified' => new \Zend_Db_Expr('null'),
],
$where
);
return $num;
} | php | public function resetWishlists($from = null, $to = null)
{
$conn = $this->getConnection();
if ($from && $to) {
$where = [
'created_at >= ?' => $from . ' 00:00:00',
'created_at <= ?' => $to . ' 23:59:59',
'wishlist_imported is ?' => new \Zend_Db_Expr('not null')
];
} else {
$where = $conn->quoteInto(
'wishlist_imported is ?',
new \Zend_Db_Expr('not null')
);
}
$num = $conn->update(
$this->getTable(Schema::EMAIL_WISHLIST_TABLE),
[
'wishlist_imported' => new \Zend_Db_Expr('null'),
'wishlist_modified' => new \Zend_Db_Expr('null'),
],
$where
);
return $num;
} | [
"public",
"function",
"resetWishlists",
"(",
"$",
"from",
"=",
"null",
",",
"$",
"to",
"=",
"null",
")",
"{",
"$",
"conn",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",
";",
"if",
"(",
"$",
"from",
"&&",
"$",
"to",
")",
"{",
"$",
"where",
... | Reset the email wishlist for re-import.
@param string|null $from
@param string|null $to
@return int | [
"Reset",
"the",
"email",
"wishlist",
"for",
"re",
"-",
"import",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/ResourceModel/Wishlist.php#L55-L80 | train |
dotmailer/dotmailer-magento2-extension | Model/Sales/Quote.php | Quote.processAbandonedCarts | public function processAbandonedCarts()
{
$result = [];
$stores = $this->helper->getStores();
$this->acPendingContactUpdater->update();
foreach ($stores as $store) {
$storeId = $store->getId();
$websiteId = $store->getWebsiteId();
$result = $this->processAbandonedCartsForCustomers($storeId, $websiteId, $result);
$result = $this->processAbandonedCartsForGuests($storeId, $websiteId, $result);
}
return $result;
} | php | public function processAbandonedCarts()
{
$result = [];
$stores = $this->helper->getStores();
$this->acPendingContactUpdater->update();
foreach ($stores as $store) {
$storeId = $store->getId();
$websiteId = $store->getWebsiteId();
$result = $this->processAbandonedCartsForCustomers($storeId, $websiteId, $result);
$result = $this->processAbandonedCartsForGuests($storeId, $websiteId, $result);
}
return $result;
} | [
"public",
"function",
"processAbandonedCarts",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"stores",
"=",
"$",
"this",
"->",
"helper",
"->",
"getStores",
"(",
")",
";",
"$",
"this",
"->",
"acPendingContactUpdater",
"->",
"update",
"(",
")",
... | Process abandoned carts.
@return array | [
"Process",
"abandoned",
"carts",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sales/Quote.php#L188-L203 | train |
dotmailer/dotmailer-magento2-extension | Model/Sales/Quote.php | Quote.processAbandonedCartsForCustomers | private function processAbandonedCartsForCustomers($storeId, $websiteId, $result)
{
$secondCustomerEnabled = $this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_TWO, $storeId);
$thirdCustomerEnabled = $this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_THREE, $storeId);
//first customer
if ($this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_ONE, $storeId) ||
$secondCustomerEnabled ||
$thirdCustomerEnabled
) {
$result[$storeId]['firstCustomer'] = $this->processCustomerFirstAbandonedCart($storeId);
}
//second customer
if ($secondCustomerEnabled) {
$result[$storeId]['secondCustomer'] = $this->processExistingAbandonedCart(
$this->getLostBasketCustomerCampaignId(self::CUSTOMER_LOST_BASKET_TWO, $storeId),
$storeId,
$websiteId,
self::CUSTOMER_LOST_BASKET_TWO
);
}
//third customer
if ($thirdCustomerEnabled) {
$result[$storeId]['thirdCustomer'] = $this->processExistingAbandonedCart(
$this->getLostBasketCustomerCampaignId(self::CUSTOMER_LOST_BASKET_THREE, $storeId),
$storeId,
$websiteId,
self::CUSTOMER_LOST_BASKET_THREE
);
}
return $result;
} | php | private function processAbandonedCartsForCustomers($storeId, $websiteId, $result)
{
$secondCustomerEnabled = $this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_TWO, $storeId);
$thirdCustomerEnabled = $this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_THREE, $storeId);
//first customer
if ($this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_ONE, $storeId) ||
$secondCustomerEnabled ||
$thirdCustomerEnabled
) {
$result[$storeId]['firstCustomer'] = $this->processCustomerFirstAbandonedCart($storeId);
}
//second customer
if ($secondCustomerEnabled) {
$result[$storeId]['secondCustomer'] = $this->processExistingAbandonedCart(
$this->getLostBasketCustomerCampaignId(self::CUSTOMER_LOST_BASKET_TWO, $storeId),
$storeId,
$websiteId,
self::CUSTOMER_LOST_BASKET_TWO
);
}
//third customer
if ($thirdCustomerEnabled) {
$result[$storeId]['thirdCustomer'] = $this->processExistingAbandonedCart(
$this->getLostBasketCustomerCampaignId(self::CUSTOMER_LOST_BASKET_THREE, $storeId),
$storeId,
$websiteId,
self::CUSTOMER_LOST_BASKET_THREE
);
}
return $result;
} | [
"private",
"function",
"processAbandonedCartsForCustomers",
"(",
"$",
"storeId",
",",
"$",
"websiteId",
",",
"$",
"result",
")",
"{",
"$",
"secondCustomerEnabled",
"=",
"$",
"this",
"->",
"isLostBasketCustomerEnabled",
"(",
"self",
"::",
"CUSTOMER_LOST_BASKET_TWO",
... | Process abandoned carts for customer
@param int $storeId
@param int $websiteId
@param array $result
@return array | [
"Process",
"abandoned",
"carts",
"for",
"customer"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sales/Quote.php#L214-L248 | train |
dotmailer/dotmailer-magento2-extension | Model/Sales/Quote.php | Quote.processAbandonedCartsForGuests | private function processAbandonedCartsForGuests($storeId, $websiteId, $result)
{
$secondGuestEnabled = $this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_TWO, $storeId);
$thirdGuestEnabled = $this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_THREE, $storeId);
//first guest
if ($this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_ONE, $storeId) ||
$secondGuestEnabled ||
$thirdGuestEnabled
) {
$result[$storeId]['firstGuest'] = $this->processGuestFirstAbandonedCart($storeId);
}
//second guest
if ($secondGuestEnabled) {
$result[$storeId]['secondGuest'] = $this->processExistingAbandonedCart(
$this->getLostBasketGuestCampaignId(self::GUEST_LOST_BASKET_TWO, $storeId),
$storeId,
$websiteId,
self::GUEST_LOST_BASKET_TWO,
true
);
}
//third guest
if ($thirdGuestEnabled) {
$result[$storeId]['thirdGuest'] = $this->processExistingAbandonedCart(
$this->getLostBasketGuestCampaignId(self::GUEST_LOST_BASKET_THREE, $storeId),
$storeId,
$websiteId,
self::GUEST_LOST_BASKET_THREE,
true
);
}
return $result;
} | php | private function processAbandonedCartsForGuests($storeId, $websiteId, $result)
{
$secondGuestEnabled = $this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_TWO, $storeId);
$thirdGuestEnabled = $this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_THREE, $storeId);
//first guest
if ($this->isLostBasketGuestEnabled(self::GUEST_LOST_BASKET_ONE, $storeId) ||
$secondGuestEnabled ||
$thirdGuestEnabled
) {
$result[$storeId]['firstGuest'] = $this->processGuestFirstAbandonedCart($storeId);
}
//second guest
if ($secondGuestEnabled) {
$result[$storeId]['secondGuest'] = $this->processExistingAbandonedCart(
$this->getLostBasketGuestCampaignId(self::GUEST_LOST_BASKET_TWO, $storeId),
$storeId,
$websiteId,
self::GUEST_LOST_BASKET_TWO,
true
);
}
//third guest
if ($thirdGuestEnabled) {
$result[$storeId]['thirdGuest'] = $this->processExistingAbandonedCart(
$this->getLostBasketGuestCampaignId(self::GUEST_LOST_BASKET_THREE, $storeId),
$storeId,
$websiteId,
self::GUEST_LOST_BASKET_THREE,
true
);
}
return $result;
} | [
"private",
"function",
"processAbandonedCartsForGuests",
"(",
"$",
"storeId",
",",
"$",
"websiteId",
",",
"$",
"result",
")",
"{",
"$",
"secondGuestEnabled",
"=",
"$",
"this",
"->",
"isLostBasketGuestEnabled",
"(",
"self",
"::",
"GUEST_LOST_BASKET_TWO",
",",
"$",
... | Process abandoned carts for guests
@param int $storeId
@param int $websiteId
@param array $result
@return array | [
"Process",
"abandoned",
"carts",
"for",
"guests"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sales/Quote.php#L259-L293 | train |
dotmailer/dotmailer-magento2-extension | Model/Sales/Quote.php | Quote.isIntervalCampaignFound | public function isIntervalCampaignFound($email, $storeId)
{
$cartLimit = $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_CART_LIMIT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
//no limit is set skip
if (! $cartLimit) {
return false;
}
$fromTime = $this->timeZone->scopeDate($storeId, 'now', true);
$toTime = clone $fromTime;
$interval = $this->dateIntervalFactory->create(
['interval_spec' => sprintf('PT%sH', $cartLimit)]
);
$fromTime->sub($interval);
$fromDate = $fromTime->getTimestamp();
$toDate = $toTime->getTimestamp();
$updated = [
'from' => $fromDate,
'to' => $toDate,
'date' => true,
];
//total campaigns sent for this interval of time
$campaignLimit = $this->campaignCollection->create()
->getNumberOfCampaignsForContactByInterval($email, $updated);
//found campaign
if ($campaignLimit) {
return true;
}
return false;
} | php | public function isIntervalCampaignFound($email, $storeId)
{
$cartLimit = $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ABANDONED_CART_LIMIT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
//no limit is set skip
if (! $cartLimit) {
return false;
}
$fromTime = $this->timeZone->scopeDate($storeId, 'now', true);
$toTime = clone $fromTime;
$interval = $this->dateIntervalFactory->create(
['interval_spec' => sprintf('PT%sH', $cartLimit)]
);
$fromTime->sub($interval);
$fromDate = $fromTime->getTimestamp();
$toDate = $toTime->getTimestamp();
$updated = [
'from' => $fromDate,
'to' => $toDate,
'date' => true,
];
//total campaigns sent for this interval of time
$campaignLimit = $this->campaignCollection->create()
->getNumberOfCampaignsForContactByInterval($email, $updated);
//found campaign
if ($campaignLimit) {
return true;
}
return false;
} | [
"public",
"function",
"isIntervalCampaignFound",
"(",
"$",
"email",
",",
"$",
"storeId",
")",
"{",
"$",
"cartLimit",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
... | Send email only if the interval limit passed, no emails during this interval.
Return false for any found for this period.
@param string $email
@param int $storeId
@return bool | [
"Send",
"email",
"only",
"if",
"the",
"interval",
"limit",
"passed",
"no",
"emails",
"during",
"this",
"interval",
".",
"Return",
"false",
"for",
"any",
"found",
"for",
"this",
"period",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Model/Sales/Quote.php#L380-L418 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.getAuthorizeLink | public function getAuthorizeLink($website = 0)
{
//base url, check for custom oauth domain
if ($this->isAuthorizeCustomDomain($website)) {
$baseUrl = $this->getWebsiteConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN)
. self::API_CONNECTOR_OAUTH_URL_AUTHORISE;
} else {
$baseUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_AUTHORISE;
}
return $baseUrl;
} | php | public function getAuthorizeLink($website = 0)
{
//base url, check for custom oauth domain
if ($this->isAuthorizeCustomDomain($website)) {
$baseUrl = $this->getWebsiteConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN)
. self::API_CONNECTOR_OAUTH_URL_AUTHORISE;
} else {
$baseUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_AUTHORISE;
}
return $baseUrl;
} | [
"public",
"function",
"getAuthorizeLink",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"//base url, check for custom oauth domain",
"if",
"(",
"$",
"this",
"->",
"isAuthorizeCustomDomain",
"(",
"$",
"website",
")",
")",
"{",
"$",
"baseUrl",
"=",
"$",
"this",
"->",... | Authorization link for OAUTH.
@param int $website
@return string | [
"Authorization",
"link",
"for",
"OAUTH",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L310-L321 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.isAuthorizeCustomDomain | private function isAuthorizeCustomDomain($website = 0)
{
$website = $this->storeManager->getWebsite($website);
$customDomain = $website->getConfig(
self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN
);
return (bool)$customDomain;
} | php | private function isAuthorizeCustomDomain($website = 0)
{
$website = $this->storeManager->getWebsite($website);
$customDomain = $website->getConfig(
self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN
);
return (bool)$customDomain;
} | [
"private",
"function",
"isAuthorizeCustomDomain",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"$",
"customDomain",
"=",
"$",
"website",
"->",
"getConfig... | Is authorization link for custom domain set.
@param int $website
@return bool | [
"Is",
"authorization",
"link",
"for",
"custom",
"domain",
"set",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L330-L338 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.getRegionAuthorize | private function getRegionAuthorize($website)
{
$website = $this->storeManager->getWebsite($website);
$apiEndpoint = $this->getWebsiteConfig(self::PATH_FOR_API_ENDPOINT, $website) . '/';
//replace the api with the app prefix from the domain name
$regionBaseUrl = str_replace('api', 'app', $apiEndpoint);
return $regionBaseUrl;
} | php | private function getRegionAuthorize($website)
{
$website = $this->storeManager->getWebsite($website);
$apiEndpoint = $this->getWebsiteConfig(self::PATH_FOR_API_ENDPOINT, $website) . '/';
//replace the api with the app prefix from the domain name
$regionBaseUrl = str_replace('api', 'app', $apiEndpoint);
return $regionBaseUrl;
} | [
"private",
"function",
"getRegionAuthorize",
"(",
"$",
"website",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"$",
"apiEndpoint",
"=",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"sel... | Region aware authorize link.
@param \Magento\Store\Api\Data\WebsiteInterface|int $website
@return string|array | [
"Region",
"aware",
"authorize",
"link",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L347-L356 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.getCallbackUrl | public function getCallbackUrl()
{
if ($callback = $this->scopeConfig->getValue(self::XML_PATH_CONNECTOR_CUSTOM_AUTHORIZATION)) {
return $callback;
}
return $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_WEB,
true
);
} | php | public function getCallbackUrl()
{
if ($callback = $this->scopeConfig->getValue(self::XML_PATH_CONNECTOR_CUSTOM_AUTHORIZATION)) {
return $callback;
}
return $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_WEB,
true
);
} | [
"public",
"function",
"getCallbackUrl",
"(",
")",
"{",
"if",
"(",
"$",
"callback",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_PATH_CONNECTOR_CUSTOM_AUTHORIZATION",
")",
")",
"{",
"return",
"$",
"callback",
";",
"}",
"ret... | Callback authorization url.
@return string | [
"Callback",
"authorization",
"url",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L363-L373 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.getTokenUrl | public function getTokenUrl($website = 0)
{
if ($this->isAuthorizeCustomDomain($website)) {
$website = $this->storeManager->getWebsite($website);
$tokenUrl = $website->getConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN) .
self::API_CONNECTOR_OAUTH_URL_TOKEN;
} else {
$tokenUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_TOKEN;
}
return $tokenUrl;
} | php | public function getTokenUrl($website = 0)
{
if ($this->isAuthorizeCustomDomain($website)) {
$website = $this->storeManager->getWebsite($website);
$tokenUrl = $website->getConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN) .
self::API_CONNECTOR_OAUTH_URL_TOKEN;
} else {
$tokenUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_TOKEN;
}
return $tokenUrl;
} | [
"public",
"function",
"getTokenUrl",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthorizeCustomDomain",
"(",
"$",
"website",
")",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
... | Token url for OAUTH.
@param int $website
@return string | [
"Token",
"url",
"for",
"OAUTH",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L382-L393 | train |
dotmailer/dotmailer-magento2-extension | Helper/Config.php | Config.getLogUserUrl | public function getLogUserUrl($website = 0)
{
if ($this->isAuthorizeCustomDomain($website)) {
$logUserUrl = $this->getWebsiteConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN)
. self::API_CONNECTOR_OAUTH_URL_LOG_USER;
} else {
$logUserUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_LOG_USER;
}
return $logUserUrl;
} | php | public function getLogUserUrl($website = 0)
{
if ($this->isAuthorizeCustomDomain($website)) {
$logUserUrl = $this->getWebsiteConfig(self::XML_PATH_CONNECTOR_CUSTOM_DOMAIN)
. self::API_CONNECTOR_OAUTH_URL_LOG_USER;
} else {
$logUserUrl = $this->getRegionAuthorize($website) . self::API_CONNECTOR_OAUTH_URL_LOG_USER;
}
return $logUserUrl;
} | [
"public",
"function",
"getLogUserUrl",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthorizeCustomDomain",
"(",
"$",
"website",
")",
")",
"{",
"$",
"logUserUrl",
"=",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"self",
"::",... | Get login user url with for OAUTH.
@param int $website
@return string | [
"Get",
"login",
"user",
"url",
"with",
"for",
"OAUTH",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Config.php#L402-L412 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isEnabled | public function isEnabled($website = 0)
{
$website = $this->storeManager->getWebsite($website);
$enabled = $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
$apiUsername = $this->getApiUsername($website);
$apiPassword = $this->getApiPassword($website);
if (! $apiUsername || ! $apiPassword || ! $enabled) {
return false;
}
return true;
} | php | public function isEnabled($website = 0)
{
$website = $this->storeManager->getWebsite($website);
$enabled = $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_API_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
$apiUsername = $this->getApiUsername($website);
$apiPassword = $this->getApiPassword($website);
if (! $apiUsername || ! $apiPassword || ! $enabled) {
return false;
}
return true;
} | [
"public",
"function",
"isEnabled",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"$",
"enabled",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFl... | Get api creadentials enabled.
@param int $website
@return bool | [
"Get",
"api",
"creadentials",
"enabled",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L194-L209 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.auth | public function auth($authRequest)
{
if ($authRequest != $this->scopeConfig->getValue(
Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE
)
) {
return false;
}
return true;
} | php | public function auth($authRequest)
{
if ($authRequest != $this->scopeConfig->getValue(
Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE
)
) {
return false;
}
return true;
} | [
"public",
"function",
"auth",
"(",
"$",
"authRequest",
")",
"{",
"if",
"(",
"$",
"authRequest",
"!=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"Config",
"::",
"XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE",
")",
")",
"{",
"return",
"false",
";",... | Passcode for dynamic content liks.
@param string $authRequest
@return bool | [
"Passcode",
"for",
"dynamic",
"content",
"liks",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L244-L254 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isIpAllowed | public function isIpAllowed()
{
if ($ipString = $this->getConfigValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_IP_RESTRICTION_ADDRESSES,
'default'
)
) {
//string to array
$ipArray = explode(',', $ipString);
//remove white spaces
foreach ($ipArray as $key => $ip) {
$ipArray[$key] = trim($ip);
}
//ip address
$ipAddress = $this->_remoteAddress->getRemoteAddress();
if (in_array($ipAddress, $ipArray)) {
return true;
}
} else {
//empty ip list from configuration will ignore the validation
return true;
}
$this->log(sprintf("Failed to authenticate IP address - %s", $ipAddress));
return false;
} | php | public function isIpAllowed()
{
if ($ipString = $this->getConfigValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_IP_RESTRICTION_ADDRESSES,
'default'
)
) {
//string to array
$ipArray = explode(',', $ipString);
//remove white spaces
foreach ($ipArray as $key => $ip) {
$ipArray[$key] = trim($ip);
}
//ip address
$ipAddress = $this->_remoteAddress->getRemoteAddress();
if (in_array($ipAddress, $ipArray)) {
return true;
}
} else {
//empty ip list from configuration will ignore the validation
return true;
}
$this->log(sprintf("Failed to authenticate IP address - %s", $ipAddress));
return false;
} | [
"public",
"function",
"isIpAllowed",
"(",
")",
"{",
"if",
"(",
"$",
"ipString",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_IP_RESTRICTION_ADDRESSES",
",",
"'def... | Check for IP address to match the ones from config.
@return bool | [
"Check",
"for",
"IP",
"address",
"to",
"match",
"the",
"ones",
"from",
"config",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L261-L290 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getConfigValue | public function getConfigValue(
$path,
$contextScope = 'default',
$contextScopeId = null
) {
$config = $this->scopeConfig->getValue(
$path,
$contextScope,
$contextScopeId
);
return $config;
} | php | public function getConfigValue(
$path,
$contextScope = 'default',
$contextScopeId = null
) {
$config = $this->scopeConfig->getValue(
$path,
$contextScope,
$contextScopeId
);
return $config;
} | [
"public",
"function",
"getConfigValue",
"(",
"$",
"path",
",",
"$",
"contextScope",
"=",
"'default'",
",",
"$",
"contextScopeId",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"$",
"path",
",",
"$",
... | Get config scope value.
@param string $path
@param string $contextScope
@param null $contextScopeId
@return int|float|string|boolean | [
"Get",
"config",
"scope",
"value",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L301-L313 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getWebsite | public function getWebsite()
{
$websiteId = $this->_request->getParam('website', false);
if ($websiteId) {
return $this->storeManager->getWebsite($websiteId);
}
return $this->storeManager->getWebsite();
} | php | public function getWebsite()
{
$websiteId = $this->_request->getParam('website', false);
if ($websiteId) {
return $this->storeManager->getWebsite($websiteId);
}
return $this->storeManager->getWebsite();
} | [
"public",
"function",
"getWebsite",
"(",
")",
"{",
"$",
"websiteId",
"=",
"$",
"this",
"->",
"_request",
"->",
"getParam",
"(",
"'website'",
",",
"false",
")",
";",
"if",
"(",
"$",
"websiteId",
")",
"{",
"return",
"$",
"this",
"->",
"storeManager",
"->... | Get website selected in admin.
@return \Magento\Store\Api\Data\WebsiteInterface | [
"Get",
"website",
"selected",
"in",
"admin",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L346-L354 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getWebsiteForSelectedScopeInAdmin | public function getWebsiteForSelectedScopeInAdmin()
{
/**
* See first if store param exist. If it does than get website from store.
* If website param does not exist then default value returned 0 "default scope"
* This is because there is no website param in default scope
*/
$storeId = $this->_request->getParam('store');
$websiteId = ($storeId) ? $this->storeManager->getStore($storeId)->getWebsiteId() :
$this->_request->getParam('website', 0);
return $this->storeManager->getWebsite($websiteId);
} | php | public function getWebsiteForSelectedScopeInAdmin()
{
/**
* See first if store param exist. If it does than get website from store.
* If website param does not exist then default value returned 0 "default scope"
* This is because there is no website param in default scope
*/
$storeId = $this->_request->getParam('store');
$websiteId = ($storeId) ? $this->storeManager->getStore($storeId)->getWebsiteId() :
$this->_request->getParam('website', 0);
return $this->storeManager->getWebsite($websiteId);
} | [
"public",
"function",
"getWebsiteForSelectedScopeInAdmin",
"(",
")",
"{",
"/**\n * See first if store param exist. If it does than get website from store.\n * If website param does not exist then default value returned 0 \"default scope\"\n * This is because there is no website p... | Get website for selected scope in admin
@return \Magento\Store\Api\Data\WebsiteInterface | [
"Get",
"website",
"for",
"selected",
"scope",
"in",
"admin"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L361-L372 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getPasscode | public function getPasscode()
{
$websiteId = (int) $this->_request->getParam('website', false);
$scope = 'default';
$scopeId = '0';
if ($websiteId) {
$scope = 'website';
$scopeId = $websiteId;
}
$passcode = $this->getConfigValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE,
$scope,
$scopeId
);
return $passcode;
} | php | public function getPasscode()
{
$websiteId = (int) $this->_request->getParam('website', false);
$scope = 'default';
$scopeId = '0';
if ($websiteId) {
$scope = 'website';
$scopeId = $websiteId;
}
$passcode = $this->getConfigValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE,
$scope,
$scopeId
);
return $passcode;
} | [
"public",
"function",
"getPasscode",
"(",
")",
"{",
"$",
"websiteId",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"_request",
"->",
"getParam",
"(",
"'website'",
",",
"false",
")",
";",
"$",
"scope",
"=",
"'default'",
";",
"$",
"scopeId",
"=",
"'0'",
";... | Get passcode from config.
@return string | [
"Get",
"passcode",
"from",
"config",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L379-L397 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.saveConfigData | public function saveConfigData($path, $value, $scope, $scopeId)
{
$this->resourceConfig->saveConfig(
$path,
$value,
$scope,
$scopeId
);
} | php | public function saveConfigData($path, $value, $scope, $scopeId)
{
$this->resourceConfig->saveConfig(
$path,
$value,
$scope,
$scopeId
);
} | [
"public",
"function",
"saveConfigData",
"(",
"$",
"path",
",",
"$",
"value",
",",
"$",
"scope",
",",
"$",
"scopeId",
")",
"{",
"$",
"this",
"->",
"resourceConfig",
"->",
"saveConfig",
"(",
"$",
"path",
",",
"$",
"value",
",",
"$",
"scope",
",",
"$",
... | Save config data.
@param string $path
@param string $value
@param string $scope
@param int $scopeId
@return null | [
"Save",
"config",
"data",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L409-L417 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.disableTransactionalDataConfig | public function disableTransactionalDataConfig($scope, $scopeId)
{
$this->resourceConfig->saveConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED,
0,
$scope,
$scopeId
);
} | php | public function disableTransactionalDataConfig($scope, $scopeId)
{
$this->resourceConfig->saveConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED,
0,
$scope,
$scopeId
);
} | [
"public",
"function",
"disableTransactionalDataConfig",
"(",
"$",
"scope",
",",
"$",
"scopeId",
")",
"{",
"$",
"this",
"->",
"resourceConfig",
"->",
"saveConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNEC... | Disable wishlist sync.
@param string $scope
@param int $scopeId
@return null | [
"Disable",
"wishlist",
"sync",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L441-L449 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isRoiTrackingEnabled | public function isRoiTrackingEnabled()
{
return (bool)$this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED
);
} | php | public function isRoiTrackingEnabled()
{
return (bool)$this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED
);
} | [
"public",
"function",
"isRoiTrackingEnabled",
"(",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_ROI_TRACKING_ENABLE... | Is the Roi page tracking enabled.
@return bool | [
"Is",
"the",
"Roi",
"page",
"tracking",
"enabled",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L528-L533 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getMappedStoreName | public function getMappedStoreName(\Magento\Store\Model\Website $website)
{
$mapped = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME
);
$storeName = ($mapped) ? $mapped : '';
return $storeName;
} | php | public function getMappedStoreName(\Magento\Store\Model\Website $website)
{
$mapped = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME
);
$storeName = ($mapped) ? $mapped : '';
return $storeName;
} | [
"public",
"function",
"getMappedStoreName",
"(",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"Website",
"$",
"website",
")",
"{",
"$",
"mapped",
"=",
"$",
"website",
"->",
"getConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"... | Store name datafield.
@param \Magento\Store\Model\Website $website
@return boolean|string | [
"Store",
"name",
"datafield",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L542-L550 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getContactId | public function getContactId($email, $websiteId)
{
if (! $this->isEnabled($websiteId)) {
return false;
}
$contactFromTable = $this->getContactByEmail($email, $websiteId);
if ($contactId = $contactFromTable->getContactId()) {
return $contactId;
}
$contact = $this->getContact($email, $websiteId, $contactFromTable);
if ($contact && isset($contact->id)) {
return $contact->id;
}
return false;
} | php | public function getContactId($email, $websiteId)
{
if (! $this->isEnabled($websiteId)) {
return false;
}
$contactFromTable = $this->getContactByEmail($email, $websiteId);
if ($contactId = $contactFromTable->getContactId()) {
return $contactId;
}
$contact = $this->getContact($email, $websiteId, $contactFromTable);
if ($contact && isset($contact->id)) {
return $contact->id;
}
return false;
} | [
"public",
"function",
"getContactId",
"(",
"$",
"email",
",",
"$",
"websiteId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
"$",
"websiteId",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"contactFromTable",
"=",
"$",
"this",
"-... | Get the contact id for the customer based on website id.
@param string $email
@param int $websiteId
@return bool|string | [
"Get",
"the",
"contact",
"id",
"for",
"the",
"customer",
"based",
"on",
"website",
"id",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L560-L577 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getWebsiteApiClient | public function getWebsiteApiClient($website = 0, $username = '', $password = '')
{
if ($username && $password) {
$apiUsername = $username;
$apiPassword = $password;
} else {
$apiUsername = $this->getApiUsername($website);
$apiPassword = $this->getApiPassword($website);
}
$client = $this->clientFactory->create();
$client->setApiUsername($apiUsername)
->setApiPassword($apiPassword);
$websiteId = $this->storeManager->getWebsite($website)->getId();
//Get api endpoint
$apiEndpoint = $this->getApiEndpoint($websiteId, $client);
//Set api endpoint on client
if ($apiEndpoint) {
$client->setApiEndpoint($apiEndpoint);
}
return $client;
} | php | public function getWebsiteApiClient($website = 0, $username = '', $password = '')
{
if ($username && $password) {
$apiUsername = $username;
$apiPassword = $password;
} else {
$apiUsername = $this->getApiUsername($website);
$apiPassword = $this->getApiPassword($website);
}
$client = $this->clientFactory->create();
$client->setApiUsername($apiUsername)
->setApiPassword($apiPassword);
$websiteId = $this->storeManager->getWebsite($website)->getId();
//Get api endpoint
$apiEndpoint = $this->getApiEndpoint($websiteId, $client);
//Set api endpoint on client
if ($apiEndpoint) {
$client->setApiEndpoint($apiEndpoint);
}
return $client;
} | [
"public",
"function",
"getWebsiteApiClient",
"(",
"$",
"website",
"=",
"0",
",",
"$",
"username",
"=",
"''",
",",
"$",
"password",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"username",
"&&",
"$",
"password",
")",
"{",
"$",
"apiUsername",
"=",
"$",
"userna... | Api client by website.
@param int $website
@param string $username
@param string $password
@return \Dotdigitalgroup\Email\Model\Apiconnector\Client | [
"Api",
"client",
"by",
"website",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L635-L659 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getApiEndpoint | public function getApiEndpoint($websiteId, $client)
{
//Get from DB
$apiEndpoint = $this->getApiEndPointFromConfig($websiteId);
//Nothing from DB then fetch from api
if (!$apiEndpoint) {
$apiEndpoint = $this->getApiEndPointFromApi($client);
//Save it in DB
if ($apiEndpoint) {
$this->saveApiEndpoint($apiEndpoint, $websiteId);
}
}
return $apiEndpoint;
} | php | public function getApiEndpoint($websiteId, $client)
{
//Get from DB
$apiEndpoint = $this->getApiEndPointFromConfig($websiteId);
//Nothing from DB then fetch from api
if (!$apiEndpoint) {
$apiEndpoint = $this->getApiEndPointFromApi($client);
//Save it in DB
if ($apiEndpoint) {
$this->saveApiEndpoint($apiEndpoint, $websiteId);
}
}
return $apiEndpoint;
} | [
"public",
"function",
"getApiEndpoint",
"(",
"$",
"websiteId",
",",
"$",
"client",
")",
"{",
"//Get from DB",
"$",
"apiEndpoint",
"=",
"$",
"this",
"->",
"getApiEndPointFromConfig",
"(",
"$",
"websiteId",
")",
";",
"//Nothing from DB then fetch from api",
"if",
"(... | Get Api endPoint
@param int $websiteId
@param \Dotdigitalgroup\Email\Model\Apiconnector\Client $client
@return string| | [
"Get",
"Api",
"endPoint"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L669-L683 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getApiEndPointFromApi | public function getApiEndPointFromApi($client)
{
$accountInfo = $client->getAccountInfo();
$apiEndpoint = false;
if (is_object($accountInfo) && !isset($accountInfo->message)) {
//save endpoint for account
foreach ($accountInfo->properties as $property) {
if ($property->name == 'ApiEndpoint' && !empty($property->value)) {
$apiEndpoint = $property->value;
break;
}
}
}
return $apiEndpoint;
} | php | public function getApiEndPointFromApi($client)
{
$accountInfo = $client->getAccountInfo();
$apiEndpoint = false;
if (is_object($accountInfo) && !isset($accountInfo->message)) {
//save endpoint for account
foreach ($accountInfo->properties as $property) {
if ($property->name == 'ApiEndpoint' && !empty($property->value)) {
$apiEndpoint = $property->value;
break;
}
}
}
return $apiEndpoint;
} | [
"public",
"function",
"getApiEndPointFromApi",
"(",
"$",
"client",
")",
"{",
"$",
"accountInfo",
"=",
"$",
"client",
"->",
"getAccountInfo",
"(",
")",
";",
"$",
"apiEndpoint",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"accountInfo",
")",
"&&",
... | Get api end point from api
@param \Dotdigitalgroup\Email\Model\Apiconnector\Client $client
@return string|boolean | [
"Get",
"api",
"end",
"point",
"from",
"api"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L692-L706 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getApiEndPointFromConfig | public function getApiEndPointFromConfig($websiteId)
{
if ($websiteId > 0) {
$apiEndpoint = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$websiteId
);
} else {
$apiEndpoint = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$websiteId,
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
);
}
return $apiEndpoint;
} | php | public function getApiEndPointFromConfig($websiteId)
{
if ($websiteId > 0) {
$apiEndpoint = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$websiteId
);
} else {
$apiEndpoint = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$websiteId,
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
);
}
return $apiEndpoint;
} | [
"public",
"function",
"getApiEndPointFromConfig",
"(",
"$",
"websiteId",
")",
"{",
"if",
"(",
"$",
"websiteId",
">",
"0",
")",
"{",
"$",
"apiEndpoint",
"=",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
... | Get api end point for given website
@param int $websiteId
@return string|boolean | [
"Get",
"api",
"end",
"point",
"for",
"given",
"website"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L715-L730 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.saveApiEndpoint | public function saveApiEndpoint($apiEndpoint, $websiteId)
{
if ($websiteId > 0) {
$scope = \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE;
} else {
$scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
}
$this->writer->save(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$apiEndpoint,
$scope,
$websiteId
);
} | php | public function saveApiEndpoint($apiEndpoint, $websiteId)
{
if ($websiteId > 0) {
$scope = \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE;
} else {
$scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
}
$this->writer->save(
\Dotdigitalgroup\Email\Helper\Config::PATH_FOR_API_ENDPOINT,
$apiEndpoint,
$scope,
$websiteId
);
} | [
"public",
"function",
"saveApiEndpoint",
"(",
"$",
"apiEndpoint",
",",
"$",
"websiteId",
")",
"{",
"if",
"(",
"$",
"websiteId",
">",
"0",
")",
"{",
"$",
"scope",
"=",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",
"::",
"SCOPE_WEB... | Save api endpoint into config.
@param string $apiEndpoint
@param int $websiteId
@return null | [
"Save",
"api",
"endpoint",
"into",
"config",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L740-L753 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getCustomerAddressBook | public function getCustomerAddressBook($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | php | public function getCustomerAddressBook($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | [
"public",
"function",
"getCustomerAddressBook",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue"... | Get the addres book for customer.
@param int $website
@return string | [
"Get",
"the",
"addres",
"book",
"for",
"customer",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L789-L798 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getSubscriberAddressBook | public function getSubscriberAddressBook($website)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getId()
);
} | php | public function getSubscriberAddressBook($website)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getId()
);
} | [
"public",
"function",
"getSubscriberAddressBook",
"(",
"$",
"website",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"... | Subscriber address book.
@param \Magento\Store\Api\Data\WebsiteInterface|int $website
@return string|boolean | [
"Subscriber",
"address",
"book",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L807-L816 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getGuestAddressBook | public function getGuestAddressBook($website)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getid()
);
} | php | public function getGuestAddressBook($website)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getid()
);
} | [
"public",
"function",
"getGuestAddressBook",
"(",
"$",
"website",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"\\",
... | Guest address book.
@param \Magento\Store\Api\Data\WebsiteInterface|int $website
@return string|boolean | [
"Guest",
"address",
"book",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L825-L834 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getCustomAttributes | public function getCustomAttributes($website = 0)
{
$attr = $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getId()
);
if (!$attr) {
return [];
}
return $this->serializer->unserialize($attr);
} | php | public function getCustomAttributes($website = 0)
{
$attr = $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website->getId()
);
if (!$attr) {
return [];
}
return $this->serializer->unserialize($attr);
} | [
"public",
"function",
"getCustomAttributes",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR... | Get custom datafield mapped.
@param int $website
@return array|mixed | [
"Get",
"custom",
"datafield",
"mapped",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L855-L868 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getConfigSelectedStatus | public function getConfigSelectedStatus($website = 0)
{
$status = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_STATUS,
$website
);
if ($status) {
return explode(',', $status);
} else {
return false;
}
} | php | public function getConfigSelectedStatus($website = 0)
{
$status = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_STATUS,
$website
);
if ($status) {
return explode(',', $status);
} else {
return false;
}
} | [
"public",
"function",
"getConfigSelectedStatus",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_SYNC_ORDER... | Order status config value.
@param int $website
@return array|bool | [
"Order",
"status",
"config",
"value",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L890-L901 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getConfigSelectedCustomOrderAttributes | public function getConfigSelectedCustomOrderAttributes($website = 0)
{
$customAttributes = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOM_ORDER_ATTRIBUTES,
$website
);
if ($customAttributes) {
return explode(',', $customAttributes);
} else {
return false;
}
} | php | public function getConfigSelectedCustomOrderAttributes($website = 0)
{
$customAttributes = $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOM_ORDER_ATTRIBUTES,
$website
);
if ($customAttributes) {
return explode(',', $customAttributes);
} else {
return false;
}
} | [
"public",
"function",
"getConfigSelectedCustomOrderAttributes",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"customAttributes",
"=",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_... | Get array of custom attributes for orders from config.
@param int $website
@return array|bool | [
"Get",
"array",
"of",
"custom",
"attributes",
"for",
"orders",
"from",
"config",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L928-L939 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.setConnectorContactToReImport | public function setConnectorContactToReImport($customerId)
{
$contactModel = $this->contactFactory->create();
$contactModel->loadByCustomerId($customerId)
->setEmailImported(
\Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED
);
$this->contactResource->save($contactModel);
} | php | public function setConnectorContactToReImport($customerId)
{
$contactModel = $this->contactFactory->create();
$contactModel->loadByCustomerId($customerId)
->setEmailImported(
\Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED
);
$this->contactResource->save($contactModel);
} | [
"public",
"function",
"setConnectorContactToReImport",
"(",
"$",
"customerId",
")",
"{",
"$",
"contactModel",
"=",
"$",
"this",
"->",
"contactFactory",
"->",
"create",
"(",
")",
";",
"$",
"contactModel",
"->",
"loadByCustomerId",
"(",
"$",
"customerId",
")",
"... | Mark contact for reimport.
@param int $customerId
@return null | [
"Mark",
"contact",
"for",
"reimport",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L948-L956 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.disableConfigForWebsite | public function disableConfigForWebsite($path)
{
$scopeId = 0;
if ($website = $this->_request->getParam('website')) {
$scope = 'websites';
$scopeId = $this->storeManager->getWebsite($website)->getId();
} else {
$scope = 'default';
}
$this->resourceConfig->saveConfig(
$path,
0,
$scope,
$scopeId
);
} | php | public function disableConfigForWebsite($path)
{
$scopeId = 0;
if ($website = $this->_request->getParam('website')) {
$scope = 'websites';
$scopeId = $this->storeManager->getWebsite($website)->getId();
} else {
$scope = 'default';
}
$this->resourceConfig->saveConfig(
$path,
0,
$scope,
$scopeId
);
} | [
"public",
"function",
"disableConfigForWebsite",
"(",
"$",
"path",
")",
"{",
"$",
"scopeId",
"=",
"0",
";",
"if",
"(",
"$",
"website",
"=",
"$",
"this",
"->",
"_request",
"->",
"getParam",
"(",
"'website'",
")",
")",
"{",
"$",
"scope",
"=",
"'websites'... | Disable website config when the request is made admin area only!
@param string $path
@return null | [
"Disable",
"website",
"config",
"when",
"the",
"request",
"is",
"made",
"admin",
"area",
"only!"
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L965-L980 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getCustomersWithDuplicateEmails | public function getCustomersWithDuplicateEmails()
{
$customers = $this->customerFactory->create()
->getCollection();
//duplicate emails
$customers->getSelect()
->columns(['emails' => 'COUNT(e.entity_id)'])
->group('email')
->having('emails > ?', 1);
return $customers;
} | php | public function getCustomersWithDuplicateEmails()
{
$customers = $this->customerFactory->create()
->getCollection();
//duplicate emails
$customers->getSelect()
->columns(['emails' => 'COUNT(e.entity_id)'])
->group('email')
->having('emails > ?', 1);
return $customers;
} | [
"public",
"function",
"getCustomersWithDuplicateEmails",
"(",
")",
"{",
"$",
"customers",
"=",
"$",
"this",
"->",
"customerFactory",
"->",
"create",
"(",
")",
"->",
"getCollection",
"(",
")",
";",
"//duplicate emails",
"$",
"customers",
"->",
"getSelect",
"(",
... | Number of customers with duplicate emails, emails as total number.
@return \Magento\Customer\Model\ResourceModel\Customer\Collection | [
"Number",
"of",
"customers",
"with",
"duplicate",
"emails",
"emails",
"as",
"total",
"number",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L987-L998 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.generateDynamicUrl | public function generateDynamicUrl()
{
$website = $this->_request->getParam('website', false);
//set website url for the default store id
$website = ($website) ? $this->storeManager->getWebsite($website) : 0;
$defaultGroup = $this->storeManager->getWebsite($website)
->getDefaultGroup();
if (!$defaultGroup) {
return $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_WEB
);
}
//base url
$baseUrl = $this->storeManager->getStore(
$defaultGroup->getDefaultStore()
)->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
return $baseUrl;
} | php | public function generateDynamicUrl()
{
$website = $this->_request->getParam('website', false);
//set website url for the default store id
$website = ($website) ? $this->storeManager->getWebsite($website) : 0;
$defaultGroup = $this->storeManager->getWebsite($website)
->getDefaultGroup();
if (!$defaultGroup) {
return $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_WEB
);
}
//base url
$baseUrl = $this->storeManager->getStore(
$defaultGroup->getDefaultStore()
)->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
return $baseUrl;
} | [
"public",
"function",
"generateDynamicUrl",
"(",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"_request",
"->",
"getParam",
"(",
"'website'",
",",
"false",
")",
";",
"//set website url for the default store id",
"$",
"website",
"=",
"(",
"$",
"website",
"... | Generate the baseurl for the default store
dynamic content will be displayed.
@return string | [
"Generate",
"the",
"baseurl",
"for",
"the",
"default",
"store",
"dynamic",
"content",
"will",
"be",
"displayed",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1006-L1028 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getOrderTableDescription | public function getOrderTableDescription()
{
$salesTable = $this->adapter->getTableName('sales_order');
$adapter = $this->adapter->getConnection('sales');
$columns = $adapter->describeTable($salesTable);
return $columns;
} | php | public function getOrderTableDescription()
{
$salesTable = $this->adapter->getTableName('sales_order');
$adapter = $this->adapter->getConnection('sales');
$columns = $adapter->describeTable($salesTable);
return $columns;
} | [
"public",
"function",
"getOrderTableDescription",
"(",
")",
"{",
"$",
"salesTable",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getTableName",
"(",
"'sales_order'",
")",
";",
"$",
"adapter",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getConnection",
"(",
"'sale... | get sales_flat_order table description.
@return array | [
"get",
"sales_flat_order",
"table",
"description",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1035-L1042 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.updateDataFields | public function updateDataFields($email, $website, $storeName)
{
$data = [];
if ($storeNameKey = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME
)
) {
$data[] = [
'Key' => $storeNameKey,
'Value' => $storeName,
];
}
if ($websiteName = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME
)
) {
$data[] = [
'Key' => $websiteName,
'Value' => $website->getName(),
];
}
if (!empty($data)) {
//update data fields
if ($this->isEnabled($website)) {
$client = $this->getWebsiteApiClient($website);
$client->updateContactDatafieldsByEmail($email, $data);
}
}
} | php | public function updateDataFields($email, $website, $storeName)
{
$data = [];
if ($storeNameKey = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME
)
) {
$data[] = [
'Key' => $storeNameKey,
'Value' => $storeName,
];
}
if ($websiteName = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME
)
) {
$data[] = [
'Key' => $websiteName,
'Value' => $website->getName(),
];
}
if (!empty($data)) {
//update data fields
if ($this->isEnabled($website)) {
$client = $this->getWebsiteApiClient($website);
$client->updateContactDatafieldsByEmail($email, $data);
}
}
} | [
"public",
"function",
"updateDataFields",
"(",
"$",
"email",
",",
"$",
"website",
",",
"$",
"storeName",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"storeNameKey",
"=",
"$",
"website",
"->",
"getConfig",
"(",
"\\",
"Dotdigitalgroup",
"\... | Update data fields.
@param string $email
@param \Magento\Store\Api\Data\WebsiteInterface $website
@param string $storeName
@return null | [
"Update",
"data",
"fields",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1113-L1141 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.updateLastQuoteId | public function updateLastQuoteId($quoteId, $email, $websiteId)
{
if ($this->isEnabled($websiteId)) {
$client = $this->getWebsiteApiClient($websiteId);
//last quote id config data mapped
$quoteIdField = $this->getLastQuoteId();
$data[] = [
'Key' => $quoteIdField,
'Value' => $quoteId,
];
//update datafields for conctact
$client->updateContactDatafieldsByEmail($email, $data);
}
} | php | public function updateLastQuoteId($quoteId, $email, $websiteId)
{
if ($this->isEnabled($websiteId)) {
$client = $this->getWebsiteApiClient($websiteId);
//last quote id config data mapped
$quoteIdField = $this->getLastQuoteId();
$data[] = [
'Key' => $quoteIdField,
'Value' => $quoteId,
];
//update datafields for conctact
$client->updateContactDatafieldsByEmail($email, $data);
}
} | [
"public",
"function",
"updateLastQuoteId",
"(",
"$",
"quoteId",
",",
"$",
"email",
",",
"$",
"websiteId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEnabled",
"(",
"$",
"websiteId",
")",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"getWebsiteApiCl... | Update last quote id datafield.
@param int $quoteId
@param string $email
@param int $websiteId
@return null | [
"Update",
"last",
"quote",
"id",
"datafield",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1152-L1166 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isOrderSyncEnabled | public function isOrderSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | php | public function isOrderSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | [
"public",
"function",
"isOrderSyncEnabled",
"(",
"$",
"websiteId",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_SYNC_ORDE... | Get order sync enabled value from configuration.
@param int $websiteId
@return bool | [
"Get",
"order",
"sync",
"enabled",
"value",
"from",
"configuration",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1188-L1195 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isCatalogSyncEnabled | public function isCatalogSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | php | public function isCatalogSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | [
"public",
"function",
"isCatalogSyncEnabled",
"(",
"$",
"websiteId",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_SYNC_CA... | Get the catalog sync enabled value from config.
@param int $websiteId
@return bool | [
"Get",
"the",
"catalog",
"sync",
"enabled",
"value",
"from",
"config",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1204-L1211 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isCustomerSyncEnabled | public function isCustomerSyncEnabled($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CUSTOMER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | php | public function isCustomerSyncEnabled($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CUSTOMER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | [
"public",
"function",
"isCustomerSyncEnabled",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag"... | Customer sync enabled.
@param int $website
@return bool | [
"Customer",
"sync",
"enabled",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1220-L1229 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getSyncLimit | public function getSyncLimit($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_LIMIT,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | php | public function getSyncLimit($website = 0)
{
$website = $this->storeManager->getWebsite($website);
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_LIMIT,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$website
);
} | [
"public",
"function",
"getSyncLimit",
"(",
"$",
"website",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"website",
")",
";",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
... | Customer sync size limit.
@param int $website
@return string|boolean | [
"Customer",
"sync",
"size",
"limit",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1238-L1247 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isGuestSyncEnabled | public function isGuestSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_GUEST_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | php | public function isGuestSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->isSetFlag(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_GUEST_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | [
"public",
"function",
"isGuestSyncEnabled",
"(",
"$",
"websiteId",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_SYNC_GUES... | Get the guest sync enabled value.
@param int $websiteId
@return bool | [
"Get",
"the",
"guest",
"sync",
"enabled",
"value",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1256-L1263 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isSubscriberSyncEnabled | public function isSubscriberSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | php | public function isSubscriberSyncEnabled($websiteId = 0)
{
return $this->scopeConfig->getValue(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
$websiteId
);
} | [
"public",
"function",
"isSubscriberSyncEnabled",
"(",
"$",
"websiteId",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_SYNC_... | Is subscriber sync enabled.
@param int $websiteId
@return bool | [
"Is",
"subscriber",
"sync",
"enabled",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1272-L1279 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getAutomationIdByType | public function getAutomationIdByType($automationType, $storeId = 0)
{
$path = constant(EmailConfig::class . '::' . $automationType);
$automationCampaignId = $this->scopeConfig->getValue(
$path,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
return $automationCampaignId;
} | php | public function getAutomationIdByType($automationType, $storeId = 0)
{
$path = constant(EmailConfig::class . '::' . $automationType);
$automationCampaignId = $this->scopeConfig->getValue(
$path,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);
return $automationCampaignId;
} | [
"public",
"function",
"getAutomationIdByType",
"(",
"$",
"automationType",
",",
"$",
"storeId",
"=",
"0",
")",
"{",
"$",
"path",
"=",
"constant",
"(",
"EmailConfig",
"::",
"class",
".",
"'::'",
".",
"$",
"automationType",
")",
";",
"$",
"automationCampaignId... | Get the config id by the automation type.
@param string $automationType
@param int $storeId
@return string|boolean | [
"Get",
"the",
"config",
"id",
"by",
"the",
"automation",
"type",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1318-L1329 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.updateAbandonedProductName | public function updateAbandonedProductName($name, $email, $websiteId)
{
if ($this->isEnabled($websiteId)) {
$client = $this->getWebsiteApiClient($websiteId);
// id config data mapped
$field = $this->getAbandonedProductName();
if ($field) {
$data[] = [
'Key' => $field,
'Value' => $name,
];
//update data field for contact
$client->updateContactDatafieldsByEmail($email, $data);
}
}
} | php | public function updateAbandonedProductName($name, $email, $websiteId)
{
if ($this->isEnabled($websiteId)) {
$client = $this->getWebsiteApiClient($websiteId);
// id config data mapped
$field = $this->getAbandonedProductName();
if ($field) {
$data[] = [
'Key' => $field,
'Value' => $name,
];
//update data field for contact
$client->updateContactDatafieldsByEmail($email, $data);
}
}
} | [
"public",
"function",
"updateAbandonedProductName",
"(",
"$",
"name",
",",
"$",
"email",
",",
"$",
"websiteId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEnabled",
"(",
"$",
"websiteId",
")",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"getWebsit... | Api- update the product name most expensive.
@param string $name
@param string $email
@param int $websiteId
@return null | [
"Api",
"-",
"update",
"the",
"product",
"name",
"most",
"expensive",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1340-L1356 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getApiResponseTimeLimit | public function getApiResponseTimeLimit($websiteId = 0)
{
$website = $this->storeManager->getWebsite($websiteId);
$limit = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DEBUG_API_REQUEST_LIMIT
);
return $limit;
} | php | public function getApiResponseTimeLimit($websiteId = 0)
{
$website = $this->storeManager->getWebsite($websiteId);
$limit = $website->getConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DEBUG_API_REQUEST_LIMIT
);
return $limit;
} | [
"public",
"function",
"getApiResponseTimeLimit",
"(",
"$",
"websiteId",
"=",
"0",
")",
"{",
"$",
"website",
"=",
"$",
"this",
"->",
"storeManager",
"->",
"getWebsite",
"(",
"$",
"websiteId",
")",
";",
"$",
"limit",
"=",
"$",
"website",
"->",
"getConfig",
... | Trigger log for api calls longer then config value.
@param int $websiteId
@return boolean|string | [
"Trigger",
"log",
"for",
"api",
"calls",
"longer",
"then",
"config",
"value",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1377-L1385 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getReviewReminderAnchor | public function getReviewReminderAnchor($website)
{
return $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_AUTOMATION_REVIEW_ANCHOR,
$website
);
} | php | public function getReviewReminderAnchor($website)
{
return $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_AUTOMATION_REVIEW_ANCHOR,
$website
);
} | [
"public",
"function",
"getReviewReminderAnchor",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_AUTOMATION_REVIEW_ANCHOR",
",",
"$",
"webs... | Product review from config to link the product link.
@param int $website
@return boolean|string | [
"Product",
"review",
"from",
"config",
"to",
"link",
"the",
"product",
"link",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1407-L1413 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getReviewDisplayType | public function getReviewDisplayType($website)
{
return $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_REVIEW_DISPLAY_TYPE,
$website
);
} | php | public function getReviewDisplayType($website)
{
return $this->getWebsiteConfig(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_REVIEW_DISPLAY_TYPE,
$website
);
} | [
"public",
"function",
"getReviewDisplayType",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getWebsiteConfig",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_CONNECTOR_DYNAMIC_CONTENT_REVIEW_DISPLAY_TYPE",
"... | Get display type for review product.
@param int $website
@return boolean|string | [
"Get",
"display",
"type",
"for",
"review",
"product",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1422-L1428 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getDelay | public function getDelay($website)
{
return $this->getReviewWebsiteSettings(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_DELAY, $website);
} | php | public function getDelay($website)
{
return $this->getReviewWebsiteSettings(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_DELAY, $website);
} | [
"public",
"function",
"getDelay",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getReviewWebsiteSettings",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_REVIEW_DELAY",
",",
"$",
"website",
")",
";",... | Get review setting delay time.
@param int $website
@return int | [
"Get",
"review",
"setting",
"delay",
"time",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1460-L1463 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.isNewProductOnly | public function isNewProductOnly($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_NEW_PRODUCT,
$website
);
} | php | public function isNewProductOnly($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_NEW_PRODUCT,
$website
);
} | [
"public",
"function",
"isNewProductOnly",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getReviewWebsiteSettings",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_REVIEW_NEW_PRODUCT",
",",
"$",
"website",... | Is the review new product enabled.
@param int $website
@return bool | [
"Is",
"the",
"review",
"new",
"product",
"enabled",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1472-L1478 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getCampaign | public function getCampaign($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_CAMPAIGN,
$website
);
} | php | public function getCampaign($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_CAMPAIGN,
$website
);
} | [
"public",
"function",
"getCampaign",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getReviewWebsiteSettings",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_REVIEW_CAMPAIGN",
",",
"$",
"website",
")",
... | Get review campaign for automation review.
@param int $website
@return int | [
"Get",
"review",
"campaign",
"for",
"automation",
"review",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1487-L1493 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getAnchor | public function getAnchor($website)
{
return $this->getReviewWebsiteSettings(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_ANCHOR, $website);
} | php | public function getAnchor($website)
{
return $this->getReviewWebsiteSettings(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_ANCHOR, $website);
} | [
"public",
"function",
"getAnchor",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getReviewWebsiteSettings",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_REVIEW_ANCHOR",
",",
"$",
"website",
")",
";... | Get review anchor value.
@param int $website
@return string | [
"Get",
"review",
"anchor",
"value",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1502-L1505 | train |
dotmailer/dotmailer-magento2-extension | Helper/Data.php | Data.getDisplayType | public function getDisplayType($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_DISPLAY_TYPE,
$website
);
} | php | public function getDisplayType($website)
{
return $this->getReviewWebsiteSettings(
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_DISPLAY_TYPE,
$website
);
} | [
"public",
"function",
"getDisplayType",
"(",
"$",
"website",
")",
"{",
"return",
"$",
"this",
"->",
"getReviewWebsiteSettings",
"(",
"\\",
"Dotdigitalgroup",
"\\",
"Email",
"\\",
"Helper",
"\\",
"Config",
"::",
"XML_PATH_REVIEW_DISPLAY_TYPE",
",",
"$",
"website",
... | Get review display type.
@param int $website
@return string | [
"Get",
"review",
"display",
"type",
"."
] | 125eb29932edb08fe3438635034ced12debe2528 | https://github.com/dotmailer/dotmailer-magento2-extension/blob/125eb29932edb08fe3438635034ced12debe2528/Helper/Data.php#L1514-L1520 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.