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
sylingd/Yesf
src/Connection/Pool.php
Pool.get
public static function get($config = null) { if (!isset($config['driver'])) { throw new ConnectionException("Unknown driver"); } if (!isset($config['host']) || !isset($config['port'])) { throw new ConnectionException("Host and Port is required"); } $type = $config['driver']; $hash = md5($type . ':' . $config['host'] . ':' . $config['port']); if (!isset(self::$created_driver[$hash])) { if (isset(self::$driver[$type])) { $className = self::$driver[$type]; } else { $className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type); } self::$created_driver[$hash] = new $className($config); } return self::$created_driver[$hash]; }
php
public static function get($config = null) { if (!isset($config['driver'])) { throw new ConnectionException("Unknown driver"); } if (!isset($config['host']) || !isset($config['port'])) { throw new ConnectionException("Host and Port is required"); } $type = $config['driver']; $hash = md5($type . ':' . $config['host'] . ':' . $config['port']); if (!isset(self::$created_driver[$hash])) { if (isset(self::$driver[$type])) { $className = self::$driver[$type]; } else { $className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type); } self::$created_driver[$hash] = new $className($config); } return self::$created_driver[$hash]; }
[ "public", "static", "function", "get", "(", "$", "config", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'driver'", "]", ")", ")", "{", "throw", "new", "ConnectionException", "(", "\"Unknown driver\"", ")", ";", "}", "if", ...
Get a connection @access public @param mixed $config @return object
[ "Get", "a", "connection" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Connection/Pool.php#L70-L88
train
chameleon-system/chameleon-shop
src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemMarker.class.php
TPkgImageHotspotItemMarker.GetURLForConnectedRecord
public function GetURLForConnectedRecord() { $oSpotObject = &$this->GetFieldLinkedRecord(); $oCmsConfig = &TdbCmsConfig::GetInstance(); $sLink = $this->fieldUrl; if (is_object($oSpotObject)) { if ($oSpotObject instanceof TdbCmsTplPage) { $sLink = $this->getPageService()->getLinkToPageObjectRelative($oSpotObject); } elseif ($oSpotObject instanceof TdbShopArticle) { $sLink = $oSpotObject->GetDetailLink(); } elseif ($oSpotObject instanceof TdbShopCategory) { $sLink = $oSpotObject->GetLink(); } elseif ($oCmsConfig->GetConfigParameter('pkgArticle', false, true)) { if ($oSpotObject instanceof TPkgArticle_BreadcrumbItem) { $sLink = $oSpotObject->GetLink(); } elseif ($oSpotObject instanceof TPkgArticleCategory_BreadcrumbItem) { $sLink = $oSpotObject->GetLink(); } elseif ($oSpotObject instanceof TdbPkgArticle) { $sLink = $oSpotObject->GetLinkDetailPage(); } elseif ($oSpotObject instanceof TdbPkgArticleCategory) { $sLink = $oSpotObject->GetURL(); } } else { //nothing that we know matched - try to use generic method $sLink = $oSpotObject->GetURL(); // still no url? trigger a user error if (empty($sLink)) { trigger_error("couldn't get url from connected record object make sure you implement a method for fetching the url - maybe you have to extend ".__CLASS__.' and overwrite the method GetLinkFromConnectedRecord()', E_USER_ERROR); } } } return $sLink; }
php
public function GetURLForConnectedRecord() { $oSpotObject = &$this->GetFieldLinkedRecord(); $oCmsConfig = &TdbCmsConfig::GetInstance(); $sLink = $this->fieldUrl; if (is_object($oSpotObject)) { if ($oSpotObject instanceof TdbCmsTplPage) { $sLink = $this->getPageService()->getLinkToPageObjectRelative($oSpotObject); } elseif ($oSpotObject instanceof TdbShopArticle) { $sLink = $oSpotObject->GetDetailLink(); } elseif ($oSpotObject instanceof TdbShopCategory) { $sLink = $oSpotObject->GetLink(); } elseif ($oCmsConfig->GetConfigParameter('pkgArticle', false, true)) { if ($oSpotObject instanceof TPkgArticle_BreadcrumbItem) { $sLink = $oSpotObject->GetLink(); } elseif ($oSpotObject instanceof TPkgArticleCategory_BreadcrumbItem) { $sLink = $oSpotObject->GetLink(); } elseif ($oSpotObject instanceof TdbPkgArticle) { $sLink = $oSpotObject->GetLinkDetailPage(); } elseif ($oSpotObject instanceof TdbPkgArticleCategory) { $sLink = $oSpotObject->GetURL(); } } else { //nothing that we know matched - try to use generic method $sLink = $oSpotObject->GetURL(); // still no url? trigger a user error if (empty($sLink)) { trigger_error("couldn't get url from connected record object make sure you implement a method for fetching the url - maybe you have to extend ".__CLASS__.' and overwrite the method GetLinkFromConnectedRecord()', E_USER_ERROR); } } } return $sLink; }
[ "public", "function", "GetURLForConnectedRecord", "(", ")", "{", "$", "oSpotObject", "=", "&", "$", "this", "->", "GetFieldLinkedRecord", "(", ")", ";", "$", "oCmsConfig", "=", "&", "TdbCmsConfig", "::", "GetInstance", "(", ")", ";", "$", "sLink", "=", "$"...
fetches the connected record and tries to get a url from that. @return string
[ "fetches", "the", "connected", "record", "and", "tries", "to", "get", "a", "url", "from", "that", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemMarker.class.php#L53-L85
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopUnitOfMeasurement.class.php
TShopUnitOfMeasurement.GetBasePrice
public function GetBasePrice($sourcePrice, $sourceQuantity) { if (empty($this->fieldFactor)) { $factor = 1; } else { $factor = $this->fieldFactor; } // 4€ = 500ml; 4€ = 500(0,001)L; 4/(500*0,001)€ = 1L; 4/0,5€=1L; 8€ = 1L $conversionFactor = $sourceQuantity * $factor; if ($conversionFactor < 0.000001 && $conversionFactor > -0.000001) { $basePrice = $sourcePrice; } else { $basePrice = $sourcePrice / $conversionFactor; } return $basePrice; }
php
public function GetBasePrice($sourcePrice, $sourceQuantity) { if (empty($this->fieldFactor)) { $factor = 1; } else { $factor = $this->fieldFactor; } // 4€ = 500ml; 4€ = 500(0,001)L; 4/(500*0,001)€ = 1L; 4/0,5€=1L; 8€ = 1L $conversionFactor = $sourceQuantity * $factor; if ($conversionFactor < 0.000001 && $conversionFactor > -0.000001) { $basePrice = $sourcePrice; } else { $basePrice = $sourcePrice / $conversionFactor; } return $basePrice; }
[ "public", "function", "GetBasePrice", "(", "$", "sourcePrice", ",", "$", "sourceQuantity", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "fieldFactor", ")", ")", "{", "$", "factor", "=", "1", ";", "}", "else", "{", "$", "factor", "=", "$", ...
Returns the base price for the source price. @param float $sourcePrice @param float $sourceQuantity @return float
[ "Returns", "the", "base", "price", "for", "the", "source", "price", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopUnitOfMeasurement.class.php#L25-L41
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetContributorList($aContributorTypes) { if (!is_array($aContributorTypes)) { $aContributorTypes = array($aContributorTypes); } $aContributorTypes = TTools::MysqlRealEscapeArray($aContributorTypes); $sQuery = "SELECT `shop_contributor`.* FROM `shop_article_contributor` LEFT JOIN `shop_contributor` ON `shop_article_contributor`.`shop_contributor_id` = `shop_contributor`.`id` LEFT JOIN `shop_contributor_type` ON `shop_article_contributor`.`shop_contributor_type_id` = `shop_contributor_type`.`id` WHERE `shop_contributor_type`.`identifier` in ('".implode("', '", $aContributorTypes)."') AND `shop_article_contributor`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' ORDER BY `shop_article_contributor`.`position` "; return TdbShopContributorList::GetList($sQuery); }
php
public function &GetContributorList($aContributorTypes) { if (!is_array($aContributorTypes)) { $aContributorTypes = array($aContributorTypes); } $aContributorTypes = TTools::MysqlRealEscapeArray($aContributorTypes); $sQuery = "SELECT `shop_contributor`.* FROM `shop_article_contributor` LEFT JOIN `shop_contributor` ON `shop_article_contributor`.`shop_contributor_id` = `shop_contributor`.`id` LEFT JOIN `shop_contributor_type` ON `shop_article_contributor`.`shop_contributor_type_id` = `shop_contributor_type`.`id` WHERE `shop_contributor_type`.`identifier` in ('".implode("', '", $aContributorTypes)."') AND `shop_article_contributor`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' ORDER BY `shop_article_contributor`.`position` "; return TdbShopContributorList::GetList($sQuery); }
[ "public", "function", "&", "GetContributorList", "(", "$", "aContributorTypes", ")", "{", "if", "(", "!", "is_array", "(", "$", "aContributorTypes", ")", ")", "{", "$", "aContributorTypes", "=", "array", "(", "$", "aContributorTypes", ")", ";", "}", "$", "...
Returns Contributors for article for given types. @param array $aContributorTypes (from field 'identifier') @return TdbShopContributorList
[ "Returns", "Contributors", "for", "article", "for", "given", "types", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L91-L107
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetBasePrice
public function GetBasePrice() { $dBasePrice = $this->GetFromInternalCache('dBasePrice'); if (is_null($dBasePrice)) { $dBasePrice = false; $oUnitsOfMeasurement = $this->GetFieldShopUnitOfMeasurement(); if ($oUnitsOfMeasurement) { $dBasePrice = $oUnitsOfMeasurement->GetBasePrice($this->dPrice, $this->fieldQuantityInUnits); } $this->SetInternalCache('dBasePrice', $dBasePrice); } return $dBasePrice; }
php
public function GetBasePrice() { $dBasePrice = $this->GetFromInternalCache('dBasePrice'); if (is_null($dBasePrice)) { $dBasePrice = false; $oUnitsOfMeasurement = $this->GetFieldShopUnitOfMeasurement(); if ($oUnitsOfMeasurement) { $dBasePrice = $oUnitsOfMeasurement->GetBasePrice($this->dPrice, $this->fieldQuantityInUnits); } $this->SetInternalCache('dBasePrice', $dBasePrice); } return $dBasePrice; }
[ "public", "function", "GetBasePrice", "(", ")", "{", "$", "dBasePrice", "=", "$", "this", "->", "GetFromInternalCache", "(", "'dBasePrice'", ")", ";", "if", "(", "is_null", "(", "$", "dBasePrice", ")", ")", "{", "$", "dBasePrice", "=", "false", ";", "$",...
return the base price for 1 base unit as defined through the shop_unit_of_measurement and quantity_in_units. @return float|bool
[ "return", "the", "base", "price", "for", "1", "base", "unit", "as", "defined", "through", "the", "shop_unit_of_measurement", "and", "quantity_in_units", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L124-L137
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetReviewsPublished() { $oReviews = $this->GetFromInternalCache('oPublishedReviews'); if (is_null($oReviews)) { $oReviews = &TdbShopArticleReviewList::GetPublishedReviews($this->id, $this->iLanguageId); $this->SetInternalCache('oPublishedReviews', $oReviews); } return $oReviews; }
php
public function &GetReviewsPublished() { $oReviews = $this->GetFromInternalCache('oPublishedReviews'); if (is_null($oReviews)) { $oReviews = &TdbShopArticleReviewList::GetPublishedReviews($this->id, $this->iLanguageId); $this->SetInternalCache('oPublishedReviews', $oReviews); } return $oReviews; }
[ "public", "function", "&", "GetReviewsPublished", "(", ")", "{", "$", "oReviews", "=", "$", "this", "->", "GetFromInternalCache", "(", "'oPublishedReviews'", ")", ";", "if", "(", "is_null", "(", "$", "oReviews", ")", ")", "{", "$", "oReviews", "=", "&", ...
return all published reviews for the article. @return TdbShopArticleReviewList
[ "return", "all", "published", "reviews", "for", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L144-L153
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetReviewAverageScore
public function GetReviewAverageScore($bRecount = false) { if ($bRecount) { $oReviews = $this->GetReviewsPublished(); return $oReviews->GetAverageScore(); } else { return $this->getProductStatsService()->getStats($this->id)->getReviewAverage(); } }
php
public function GetReviewAverageScore($bRecount = false) { if ($bRecount) { $oReviews = $this->GetReviewsPublished(); return $oReviews->GetAverageScore(); } else { return $this->getProductStatsService()->getStats($this->id)->getReviewAverage(); } }
[ "public", "function", "GetReviewAverageScore", "(", "$", "bRecount", "=", "false", ")", "{", "if", "(", "$", "bRecount", ")", "{", "$", "oReviews", "=", "$", "this", "->", "GetReviewsPublished", "(", ")", ";", "return", "$", "oReviews", "->", "GetAverageSc...
return the average rating of the article based on the customer reviews for the article. @param bool $bRecount - force a recount of the actual data @return float
[ "return", "the", "average", "rating", "of", "the", "article", "based", "on", "the", "customer", "reviews", "for", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L162-L171
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetVat
public function GetVat() { $oVat = $this->GetFromInternalCache('ovat'); if (is_null($oVat)) { $oVat = $this->getOwnVat(); if (is_null($oVat)) { // try to fetch from article group $oArticleGroups = $this->GetArticleGroups(); $oVat = $oArticleGroups->GetMaxVat(); } if (is_null($oVat)) { // try to fetch from category $oCategories = $this->GetFieldShopCategoryList(); $oVat = $oCategories->GetMaxVat(); } if (is_null($oVat)) { // try to fetch from shop $oShopConfig = TdbShop::GetInstance(); $oVat = $oShopConfig->GetVat(); } $this->SetInternalCache('ovat', $oVat); } return $oVat; }
php
public function GetVat() { $oVat = $this->GetFromInternalCache('ovat'); if (is_null($oVat)) { $oVat = $this->getOwnVat(); if (is_null($oVat)) { // try to fetch from article group $oArticleGroups = $this->GetArticleGroups(); $oVat = $oArticleGroups->GetMaxVat(); } if (is_null($oVat)) { // try to fetch from category $oCategories = $this->GetFieldShopCategoryList(); $oVat = $oCategories->GetMaxVat(); } if (is_null($oVat)) { // try to fetch from shop $oShopConfig = TdbShop::GetInstance(); $oVat = $oShopConfig->GetVat(); } $this->SetInternalCache('ovat', $oVat); } return $oVat; }
[ "public", "function", "GetVat", "(", ")", "{", "$", "oVat", "=", "$", "this", "->", "GetFromInternalCache", "(", "'ovat'", ")", ";", "if", "(", "is_null", "(", "$", "oVat", ")", ")", "{", "$", "oVat", "=", "$", "this", "->", "getOwnVat", "(", ")", ...
return the vat group of the article. @return TdbShopVat
[ "return", "the", "vat", "group", "of", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L196-L222
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.getLink
public function getLink($bAbsolute = false, $sAnchor = null, $aOptionalParameters = array(), \TdbCmsPortal $portal = null, \TdbCmsLanguage $language = null) { // if no category is given, fetch the first category of the article $shopService = $this->getShopService(); $oShop = $shopService->getActiveShop(); $sCategoryId = null; if (true === array_key_exists(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY, $aOptionalParameters)) { $sCategoryId = $aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]; unset($aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]); } if (is_array($aOptionalParameters) && 0 === count($aOptionalParameters)) { $aOptionalParameters = null; } $aKey = array( 'class' => __CLASS__, 'method' => 'GetDetailLink', 'bIncludePortalLink' => $bAbsolute, TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => $sCategoryId, 'id' => $this->id, 'table' => $this->table, ); if (is_null($sCategoryId)) { $oActiveCategory = $shopService->getActiveCategory(); if ($oActiveCategory) { $aKey[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY] = $oActiveCategory->id; } } $sKey = TCacheManager::GetKey($aKey); $sLink = $this->GetFromInternalCache('link'.$sKey); if (is_null($sLink)) { if (!array_key_exists('product_url_mode', $oShop->sqlData)) { $oShop->sqlData['product_url_mode'] = 'V1'; } switch ($oShop->sqlData['product_url_mode']) { case 'V2': $sLink = $this->GetDetailLinkV2($bAbsolute, $sCategoryId, $portal, $language); break; case 'V1': default: $sLink = $this->GetDetailLinkV1($bAbsolute, $sCategoryId); break; } $this->SetInternalCache('link'.$sKey, $sLink); } if (null !== $aOptionalParameters) { $sLink .= $this->getUrlUtil()->getArrayAsUrl($aOptionalParameters, '?', '&'); } if (null !== $sAnchor) { $sLink .= '#'.urlencode($sAnchor); } return $sLink; }
php
public function getLink($bAbsolute = false, $sAnchor = null, $aOptionalParameters = array(), \TdbCmsPortal $portal = null, \TdbCmsLanguage $language = null) { // if no category is given, fetch the first category of the article $shopService = $this->getShopService(); $oShop = $shopService->getActiveShop(); $sCategoryId = null; if (true === array_key_exists(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY, $aOptionalParameters)) { $sCategoryId = $aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]; unset($aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]); } if (is_array($aOptionalParameters) && 0 === count($aOptionalParameters)) { $aOptionalParameters = null; } $aKey = array( 'class' => __CLASS__, 'method' => 'GetDetailLink', 'bIncludePortalLink' => $bAbsolute, TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => $sCategoryId, 'id' => $this->id, 'table' => $this->table, ); if (is_null($sCategoryId)) { $oActiveCategory = $shopService->getActiveCategory(); if ($oActiveCategory) { $aKey[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY] = $oActiveCategory->id; } } $sKey = TCacheManager::GetKey($aKey); $sLink = $this->GetFromInternalCache('link'.$sKey); if (is_null($sLink)) { if (!array_key_exists('product_url_mode', $oShop->sqlData)) { $oShop->sqlData['product_url_mode'] = 'V1'; } switch ($oShop->sqlData['product_url_mode']) { case 'V2': $sLink = $this->GetDetailLinkV2($bAbsolute, $sCategoryId, $portal, $language); break; case 'V1': default: $sLink = $this->GetDetailLinkV1($bAbsolute, $sCategoryId); break; } $this->SetInternalCache('link'.$sKey, $sLink); } if (null !== $aOptionalParameters) { $sLink .= $this->getUrlUtil()->getArrayAsUrl($aOptionalParameters, '?', '&'); } if (null !== $sAnchor) { $sLink .= '#'.urlencode($sAnchor); } return $sLink; }
[ "public", "function", "getLink", "(", "$", "bAbsolute", "=", "false", ",", "$", "sAnchor", "=", "null", ",", "$", "aOptionalParameters", "=", "array", "(", ")", ",", "\\", "TdbCmsPortal", "$", "portal", "=", "null", ",", "\\", "TdbCmsLanguage", "$", "lan...
return the link to the detail view of the product. @param bool $bAbsolute set to true to include the domain in the link @param string|null $sAnchor @param array $aOptionalParameters supported optional parameters: TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY - (string) force the article link to be within the given category id (only works if the category is assigned to the article) @param TdbCmsPortal|null $portal @param TdbCmsLanguage|null $language @return string
[ "return", "the", "link", "to", "the", "detail", "view", "of", "the", "product", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L258-L312
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetReviewFormLink
public function GetReviewFormLink($bIncludePortalLink = false, $iCategoryId = null) { return $this->GetDetailLink($bIncludePortalLink, $iCategoryId).'#review'.TGlobal::OutHTML($this->id); }
php
public function GetReviewFormLink($bIncludePortalLink = false, $iCategoryId = null) { return $this->GetDetailLink($bIncludePortalLink, $iCategoryId).'#review'.TGlobal::OutHTML($this->id); }
[ "public", "function", "GetReviewFormLink", "(", "$", "bIncludePortalLink", "=", "false", ",", "$", "iCategoryId", "=", "null", ")", "{", "return", "$", "this", "->", "GetDetailLink", "(", "$", "bIncludePortalLink", ",", "$", "iCategoryId", ")", ".", "'#review'...
return the link to the review page of the product. @param bool $bIncludePortalLink - set to true to include the domain in the link @param int $iCategoryId - pass a category to force a category (only works if the category is assigned to the article) @return string
[ "return", "the", "link", "to", "the", "review", "page", "of", "the", "product", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L485-L488
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetToBasketLink
public function GetToBasketLink($bIncludePortalLink = false, $bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET) { $sLink = ''; $aParameters = $this->GetToBasketLinkParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer); // convert module_fnc to array to string $aIncludeParams = TdbShop::GetURLPageStateParameters(); $oGlobal = TGlobal::instance(); foreach ($aIncludeParams as $sKeyName) { if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) { $aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName); } } return $this->generateLinkForToBasketParameters($aParameters, $bIncludePortalLink); }
php
public function GetToBasketLink($bIncludePortalLink = false, $bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET) { $sLink = ''; $aParameters = $this->GetToBasketLinkParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer); // convert module_fnc to array to string $aIncludeParams = TdbShop::GetURLPageStateParameters(); $oGlobal = TGlobal::instance(); foreach ($aIncludeParams as $sKeyName) { if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) { $aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName); } } return $this->generateLinkForToBasketParameters($aParameters, $bIncludePortalLink); }
[ "public", "function", "GetToBasketLink", "(", "$", "bIncludePortalLink", "=", "false", ",", "$", "bRedirectToBasket", "=", "false", ",", "$", "bReplaceBasketContents", "=", "false", ",", "$", "bGetAjaxParameter", "=", "false", ",", "$", "sMessageConsumer", "=", ...
generates a link that can be used to add this product to the basket. @param bool $bIncludePortalLink - include domain in link @param bool $bRedirectToBasket - redirect to basket page after adding product @param bool $bReplaceBasketContents - set to true if you want the contents of the basket to be replaced by the product wenn added to basket @param bool $bGetAjaxParameter - set to true if you want to get basket link for ajax call @param string $sMessageConsumer - set custom message consumer @return string
[ "generates", "a", "link", "that", "can", "be", "used", "to", "add", "this", "product", "to", "the", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L501-L515
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.generateLinkForToBasketParameters
protected function generateLinkForToBasketParameters($aParameters = array(), $bIncludePortalLink) { $activePage = $this->getActivePageService()->getActivePage(); if (!is_object($activePage)) { $sLink = '?'.TTools::GetArrayAsURL($aParameters); if ($bIncludePortalLink) { /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $sLink = $request->getSchemeAndHttpHost().$sLink; } } else { $sLink = $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink); } return $sLink; }
php
protected function generateLinkForToBasketParameters($aParameters = array(), $bIncludePortalLink) { $activePage = $this->getActivePageService()->getActivePage(); if (!is_object($activePage)) { $sLink = '?'.TTools::GetArrayAsURL($aParameters); if ($bIncludePortalLink) { /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $sLink = $request->getSchemeAndHttpHost().$sLink; } } else { $sLink = $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink); } return $sLink; }
[ "protected", "function", "generateLinkForToBasketParameters", "(", "$", "aParameters", "=", "array", "(", ")", ",", "$", "bIncludePortalLink", ")", "{", "$", "activePage", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")",...
Creates to basket link from given to basket parameters. @param array $aParameters @param $bIncludePortalLink @return string
[ "Creates", "to", "basket", "link", "from", "given", "to", "basket", "parameters", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L525-L540
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetToBasketLinkForExternalCalls
public function GetToBasketLinkForExternalCalls() { return 'http://'.$this->getPortalDomainService()->getActiveDomain()->getInsecureDomainName().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($this->id); }
php
public function GetToBasketLinkForExternalCalls() { return 'http://'.$this->getPortalDomainService()->getActiveDomain()->getInsecureDomainName().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($this->id); }
[ "public", "function", "GetToBasketLinkForExternalCalls", "(", ")", "{", "return", "'http://'", ".", "$", "this", "->", "getPortalDomainService", "(", ")", "->", "getActiveDomain", "(", ")", "->", "getInsecureDomainName", "(", ")", ".", "'/'", ".", "TdbShopArticle"...
returns a url to place the item in the basket from an external location. @return string
[ "returns", "a", "url", "to", "place", "the", "item", "in", "the", "basket", "from", "an", "external", "location", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L547-L550
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetToBasketLinkParameters
public function GetToBasketLinkParameters($bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET) { $aParameters = $this->getToBasketLinkBasketParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer); $aParameters = $this->getToBasketLinkOtherParameters($aParameters); return $aParameters; }
php
public function GetToBasketLinkParameters($bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET) { $aParameters = $this->getToBasketLinkBasketParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer); $aParameters = $this->getToBasketLinkOtherParameters($aParameters); return $aParameters; }
[ "public", "function", "GetToBasketLinkParameters", "(", "$", "bRedirectToBasket", "=", "false", ",", "$", "bReplaceBasketContents", "=", "false", ",", "$", "bGetAjaxParameter", "=", "false", ",", "$", "sMessageConsumer", "=", "MTShopBasketCore", "::", "MSG_CONSUMER_NA...
return parameters needed for a to basket call. @param bool $bRedirectToBasket - redirect to basket page after adding product @param bool $bReplaceBasketContents - set to true if you want the contents of the basket to be replaced by the product wenn added to basket @param bool $bGetAjaxParameter - set to true if you want to get basket link for ajax call @param string $sMessageConsumer - set custom message consumer @return array
[ "return", "parameters", "needed", "for", "a", "to", "basket", "call", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L562-L568
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetToNoticeListLink
public function GetToNoticeListLink($bIncludePortalLink = false, $sMsgConsumerName = false) { if (false === $sMsgConsumerName) { $sMsgConsumerName = $this->GetMessageConsumerName(); } $oShopConfig = TdbShop::GetInstance(); $aParameters = array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'AddToNoticeList', ), MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $sMsgConsumerName, ); $aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters(); foreach ($aParameters as $sKey => $sVal) { $aExcludeParameters[] = $sKey; } // now add all OTHER parameters $aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters); foreach ($aOtherParameters as $sKey => $sVal) { $aParameters[$sKey] = $sVal; } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink); }
php
public function GetToNoticeListLink($bIncludePortalLink = false, $sMsgConsumerName = false) { if (false === $sMsgConsumerName) { $sMsgConsumerName = $this->GetMessageConsumerName(); } $oShopConfig = TdbShop::GetInstance(); $aParameters = array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'AddToNoticeList', ), MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $sMsgConsumerName, ); $aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters(); foreach ($aParameters as $sKey => $sVal) { $aExcludeParameters[] = $sKey; } // now add all OTHER parameters $aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters); foreach ($aOtherParameters as $sKey => $sVal) { $aParameters[$sKey] = $sVal; } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink); }
[ "public", "function", "GetToNoticeListLink", "(", "$", "bIncludePortalLink", "=", "false", ",", "$", "sMsgConsumerName", "=", "false", ")", "{", "if", "(", "false", "===", "$", "sMsgConsumerName", ")", "{", "$", "sMsgConsumerName", "=", "$", "this", "->", "G...
generate a link used to add the article to the notice list. @param bool $bIncludePortalLink - include domain in link @param bool $sMsgConsumerName @return string
[ "generate", "a", "link", "used", "to", "add", "the", "article", "to", "the", "notice", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L578-L609
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetPrimaryCategory() { $oCategory = null; // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child if (!empty($this->fieldShopCategoryId)) { $oCategory = &$this->GetFieldShopCategory(); if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) { $oCategory = null; } } if (is_null($oCategory)) { $oCategories = &$this->GetFieldShopCategoryList(); $oCategories->GoToStart(); if ($oCategories->Length() > 0) { $oCategory = &$oCategories->Current(); } } if (is_null($oCategory) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oCategory = &$oParent->GetPrimaryCategory(); } return $oCategory; }
php
public function &GetPrimaryCategory() { $oCategory = null; // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child if (!empty($this->fieldShopCategoryId)) { $oCategory = &$this->GetFieldShopCategory(); if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) { $oCategory = null; } } if (is_null($oCategory)) { $oCategories = &$this->GetFieldShopCategoryList(); $oCategories->GoToStart(); if ($oCategories->Length() > 0) { $oCategory = &$oCategories->Current(); } } if (is_null($oCategory) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oCategory = &$oParent->GetPrimaryCategory(); } return $oCategory; }
[ "public", "function", "&", "GetPrimaryCategory", "(", ")", "{", "$", "oCategory", "=", "null", ";", "// if this is a variant, then we want to take the parent object instead - at least if no data is set for the child", "if", "(", "!", "empty", "(", "$", "this", "->", "fieldS...
return the primary category of the article (usually just the first one found. @return TdbShopCategory
[ "return", "the", "primary", "category", "of", "the", "article", "(", "usually", "just", "the", "first", "one", "found", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L647-L671
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetFieldShopCategoryList($sOrderBy = '') { $oCategories = &$this->GetFromInternalCache('oCategories'); if (is_null($oCategories)) { $oCategories = &TdbShopCategoryList::GetArticleCategories($this->id, $this->iLanguageId); $this->SetInternalCache('oCategories', $oCategories); } return $oCategories; }
php
public function &GetFieldShopCategoryList($sOrderBy = '') { $oCategories = &$this->GetFromInternalCache('oCategories'); if (is_null($oCategories)) { $oCategories = &TdbShopCategoryList::GetArticleCategories($this->id, $this->iLanguageId); $this->SetInternalCache('oCategories', $oCategories); } return $oCategories; }
[ "public", "function", "&", "GetFieldShopCategoryList", "(", "$", "sOrderBy", "=", "''", ")", "{", "$", "oCategories", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "'oCategories'", ")", ";", "if", "(", "is_null", "(", "$", "oCategories", ")", "...
return all categories assigned to the article. @param string $sOrderBy @return TdbShopCategoryList
[ "return", "all", "categories", "assigned", "to", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L680-L689
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetArticleGroups() { $oArticleGroups = &$this->GetFromInternalCache('oArticleGroups'); if (is_null($oArticleGroups)) { $oArticleGroups = &TdbShopArticleGroupList::GetArticleGroups($this->id); $this->SetInternalCache('oArticleGroups', $oArticleGroups); } return $oArticleGroups; }
php
public function &GetArticleGroups() { $oArticleGroups = &$this->GetFromInternalCache('oArticleGroups'); if (is_null($oArticleGroups)) { $oArticleGroups = &TdbShopArticleGroupList::GetArticleGroups($this->id); $this->SetInternalCache('oArticleGroups', $oArticleGroups); } return $oArticleGroups; }
[ "public", "function", "&", "GetArticleGroups", "(", ")", "{", "$", "oArticleGroups", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "'oArticleGroups'", ")", ";", "if", "(", "is_null", "(", "$", "oArticleGroups", ")", ")", "{", "$", "oArticleGroups...
return all article groups assigend to the article. @return TdbShopArticleGroupList
[ "return", "all", "article", "groups", "assigend", "to", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L696-L705
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetMessages
protected function GetMessages($aMessageConsumerToCheck) { $sMessages = ''; $oMsgManager = TCMSMessageManager::GetInstance(); foreach ($aMessageConsumerToCheck as $sMessageConsumer) { if ($oMsgManager->ConsumerHasMessages($sMessageConsumer)) { $sMessages .= $oMsgManager->RenderMessages($sMessageConsumer); } } return $sMessages; }
php
protected function GetMessages($aMessageConsumerToCheck) { $sMessages = ''; $oMsgManager = TCMSMessageManager::GetInstance(); foreach ($aMessageConsumerToCheck as $sMessageConsumer) { if ($oMsgManager->ConsumerHasMessages($sMessageConsumer)) { $sMessages .= $oMsgManager->RenderMessages($sMessageConsumer); } } return $sMessages; }
[ "protected", "function", "GetMessages", "(", "$", "aMessageConsumerToCheck", ")", "{", "$", "sMessages", "=", "''", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "foreach", "(", "$", "aMessageConsumerToCheck", "as", "$",...
uses message manager to render messages and return them as string. @param $aMessageConsumerToCheck @return string
[ "uses", "message", "manager", "to", "render", "messages", "and", "return", "them", "as", "string", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L756-L768
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetPrimaryImage
public function GetPrimaryImage() { $oPrimaryImage = &$this->GetFromInternalCache('oPrimaryImage'); if (is_null($oPrimaryImage)) { if (!empty($this->fieldCmsMediaDefaultPreviewImageId) && (!is_numeric($this->fieldCmsMediaDefaultPreviewImageId) || intval($this->fieldCmsMediaDefaultPreviewImageId) > 1000)) { $oShop = TdbShop::GetInstance(); $aData = array('shop_article_id' => $this->id, 'cms_media_id' => $this->fieldCmsMediaDefaultPreviewImageId, 'position' => 1); $oPrimaryImage = TdbShopArticleImage::GetNewInstance(); $oPrimaryImage->LoadFromRow($aData); } else { $oImages = &$this->GetFieldShopArticleImageList(); $activePage = $this->getActivePageService()->getActivePage(); if (0 == $oImages->Length() && (!is_null($activePage))) { $oShop = TdbShop::GetInstance(); $aData = array('shop_article_id' => $this->id, 'cms_media_id' => $oShop->fieldNotFoundImage, 'position' => 1); $oPrimaryImage = TdbShopArticleImage::GetNewInstance(); $oPrimaryImage->LoadFromRow($aData); } else { $oImages->GoToStart(); $oPrimaryImage = &$oImages->Current(); } } if (false === $oPrimaryImage) { $oPrimaryImage = null; if ($this->IsVariant()) { $oParent = $this->GetFieldVariantParent(); if (null != $oParent) { $oPrimaryImage = $oParent->GetPrimaryImage(); } } } $this->SetInternalCache('oPrimaryImage', $oPrimaryImage); } return $oPrimaryImage; }
php
public function GetPrimaryImage() { $oPrimaryImage = &$this->GetFromInternalCache('oPrimaryImage'); if (is_null($oPrimaryImage)) { if (!empty($this->fieldCmsMediaDefaultPreviewImageId) && (!is_numeric($this->fieldCmsMediaDefaultPreviewImageId) || intval($this->fieldCmsMediaDefaultPreviewImageId) > 1000)) { $oShop = TdbShop::GetInstance(); $aData = array('shop_article_id' => $this->id, 'cms_media_id' => $this->fieldCmsMediaDefaultPreviewImageId, 'position' => 1); $oPrimaryImage = TdbShopArticleImage::GetNewInstance(); $oPrimaryImage->LoadFromRow($aData); } else { $oImages = &$this->GetFieldShopArticleImageList(); $activePage = $this->getActivePageService()->getActivePage(); if (0 == $oImages->Length() && (!is_null($activePage))) { $oShop = TdbShop::GetInstance(); $aData = array('shop_article_id' => $this->id, 'cms_media_id' => $oShop->fieldNotFoundImage, 'position' => 1); $oPrimaryImage = TdbShopArticleImage::GetNewInstance(); $oPrimaryImage->LoadFromRow($aData); } else { $oImages->GoToStart(); $oPrimaryImage = &$oImages->Current(); } } if (false === $oPrimaryImage) { $oPrimaryImage = null; if ($this->IsVariant()) { $oParent = $this->GetFieldVariantParent(); if (null != $oParent) { $oPrimaryImage = $oParent->GetPrimaryImage(); } } } $this->SetInternalCache('oPrimaryImage', $oPrimaryImage); } return $oPrimaryImage; }
[ "public", "function", "GetPrimaryImage", "(", ")", "{", "$", "oPrimaryImage", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "'oPrimaryImage'", ")", ";", "if", "(", "is_null", "(", "$", "oPrimaryImage", ")", ")", "{", "if", "(", "!", "empty", ...
return the primary image object of the shop article. this is either the cms_media_default_preview_image_id or the first image in the image list. @return TdbShopArticleImage
[ "return", "the", "primary", "image", "object", "of", "the", "shop", "article", ".", "this", "is", "either", "the", "cms_media_default_preview_image_id", "or", "the", "first", "image", "in", "the", "image", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L830-L866
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.IsInArticleGroups
public function IsInArticleGroups($aGroupList) { $bIsInGroups = false; $aArticleGroups = $this->GetMLTIdList('shop_article_group'); $aIntersec = array_intersect($aArticleGroups, $aGroupList); if (0 == count($aIntersec) && 0 == count($aArticleGroups) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); if ($oParent) { $bIsInGroups = $oParent->IsInArticleGroups($aGroupList); } } else { $bIsInGroups = (count($aIntersec) > 0); } return $bIsInGroups; }
php
public function IsInArticleGroups($aGroupList) { $bIsInGroups = false; $aArticleGroups = $this->GetMLTIdList('shop_article_group'); $aIntersec = array_intersect($aArticleGroups, $aGroupList); if (0 == count($aIntersec) && 0 == count($aArticleGroups) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); if ($oParent) { $bIsInGroups = $oParent->IsInArticleGroups($aGroupList); } } else { $bIsInGroups = (count($aIntersec) > 0); } return $bIsInGroups; }
[ "public", "function", "IsInArticleGroups", "(", "$", "aGroupList", ")", "{", "$", "bIsInGroups", "=", "false", ";", "$", "aArticleGroups", "=", "$", "this", "->", "GetMLTIdList", "(", "'shop_article_group'", ")", ";", "$", "aIntersec", "=", "array_intersect", ...
return true if the article is in at least one of the groups. @param array $aGroupList @return bool
[ "return", "true", "if", "the", "article", "is", "in", "at", "least", "one", "of", "the", "groups", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L937-L953
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetExportObject
public function GetExportObject() { $oExportObject = new stdClass(); $oExportObject->id = $this->id; foreach ($this as $sPropName => $sPropVal) { if ('field' == substr($sPropName, 0, 5)) { $oExportObject->{$sPropName} = $sPropVal; } } // Add additional infos that might be useful for an export // Images if (TGlobal::IsCMSMode()) { $oPortals = &TdbCmsPortalList::GetList(); $oPortal = $oPortals->Current(); $oShop = &TdbShop::GetInstance($oPortal->id); } else { $oShop = TdbShop::GetInstance(); } $oImageSizeList = &TdbShopArticleImageSizeList::GetListForShopId($oShop->id); $oExportObject->aImages = array(); $oImagePropertyList = &$this->GetFieldShopArticleImageList(); $aImageData = array('original' => array(), 'thumb' => array()); while ($oImageProperty = &$oImagePropertyList->Next()) { $oImage = $oImageProperty->GetImage(0, 'cms_media_id'); if (null !== $oImage) { $aImageData['original'][] = $oImage->GetFullURL(); $aImageData['originalLocal'][] = $oImage->GetFullLocalPath(); } } $oImageSizeList->GoToStart(); while ($oImageSize = &$oImageSizeList->Next()) { $oPreviewImageDescription = &$this->GetImagePreviewObject($oImageSize->fieldNameInternal); if (null !== $oPreviewImageDescription) { $oImage = $oPreviewImageDescription->GetImageThumbnailObject(); $aImageData['thumb'][$oImageSize->fieldNameInternal] = $oImage->GetFullURL(); $aImageData['thumbLocal'][$oImageSize->fieldNameInternal] = $oImage->GetFullLocalPath(); } } $oExportObject->aImages = $aImageData; // DeepLink $oExportObject->fieldDeepLink = $this->GetDetailLink(true); // Author Lost $oContributorList = $this->GetContributorList(array('author')); $aContributorList = array(); while ($oContributor = $oContributorList->Next()) { $aContributorList[] = $oContributor->GetName(); } $oExportObject->aAuthors = $aContributorList; // Stock Message $oExportObject->oStockMessage = $this->GetFieldShopStockMessage(); return $oExportObject; }
php
public function GetExportObject() { $oExportObject = new stdClass(); $oExportObject->id = $this->id; foreach ($this as $sPropName => $sPropVal) { if ('field' == substr($sPropName, 0, 5)) { $oExportObject->{$sPropName} = $sPropVal; } } // Add additional infos that might be useful for an export // Images if (TGlobal::IsCMSMode()) { $oPortals = &TdbCmsPortalList::GetList(); $oPortal = $oPortals->Current(); $oShop = &TdbShop::GetInstance($oPortal->id); } else { $oShop = TdbShop::GetInstance(); } $oImageSizeList = &TdbShopArticleImageSizeList::GetListForShopId($oShop->id); $oExportObject->aImages = array(); $oImagePropertyList = &$this->GetFieldShopArticleImageList(); $aImageData = array('original' => array(), 'thumb' => array()); while ($oImageProperty = &$oImagePropertyList->Next()) { $oImage = $oImageProperty->GetImage(0, 'cms_media_id'); if (null !== $oImage) { $aImageData['original'][] = $oImage->GetFullURL(); $aImageData['originalLocal'][] = $oImage->GetFullLocalPath(); } } $oImageSizeList->GoToStart(); while ($oImageSize = &$oImageSizeList->Next()) { $oPreviewImageDescription = &$this->GetImagePreviewObject($oImageSize->fieldNameInternal); if (null !== $oPreviewImageDescription) { $oImage = $oPreviewImageDescription->GetImageThumbnailObject(); $aImageData['thumb'][$oImageSize->fieldNameInternal] = $oImage->GetFullURL(); $aImageData['thumbLocal'][$oImageSize->fieldNameInternal] = $oImage->GetFullLocalPath(); } } $oExportObject->aImages = $aImageData; // DeepLink $oExportObject->fieldDeepLink = $this->GetDetailLink(true); // Author Lost $oContributorList = $this->GetContributorList(array('author')); $aContributorList = array(); while ($oContributor = $oContributorList->Next()) { $aContributorList[] = $oContributor->GetName(); } $oExportObject->aAuthors = $aContributorList; // Stock Message $oExportObject->oStockMessage = $this->GetFieldShopStockMessage(); return $oExportObject; }
[ "public", "function", "GetExportObject", "(", ")", "{", "$", "oExportObject", "=", "new", "stdClass", "(", ")", ";", "$", "oExportObject", "->", "id", "=", "$", "this", "->", "id", ";", "foreach", "(", "$", "this", "as", "$", "sPropName", "=>", "$", ...
returns an article object with additional elements needed for exports and interfaces like full URL image links, attachment links and so on. When called from CMS BackEnd it WILL use the first portal/shop found @return stdClass
[ "returns", "an", "article", "object", "with", "additional", "elements", "needed", "for", "exports", "and", "interfaces", "like", "full", "URL", "image", "links", "attachment", "links", "and", "so", "on", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L963-L1021
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.IsInCategory
public function IsInCategory($aCategoryList) { $bIsInCategory = false; if (in_array($this->fieldShopCategoryId, $aCategoryList)) { $bIsInCategory = true; } else { $aArticleCategories = $this->GetMLTIdList('shop_category_mlt'); $aIntersec = array_intersect($aArticleCategories, $aCategoryList); if (0 == count($aIntersec) && 0 == count($aArticleCategories) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); if ($oParent) { $bIsInCategory = $oParent->IsInCategory($aCategoryList); } } else { $bIsInCategory = (count($aIntersec) > 0); } } return $bIsInCategory; }
php
public function IsInCategory($aCategoryList) { $bIsInCategory = false; if (in_array($this->fieldShopCategoryId, $aCategoryList)) { $bIsInCategory = true; } else { $aArticleCategories = $this->GetMLTIdList('shop_category_mlt'); $aIntersec = array_intersect($aArticleCategories, $aCategoryList); if (0 == count($aIntersec) && 0 == count($aArticleCategories) && $this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); if ($oParent) { $bIsInCategory = $oParent->IsInCategory($aCategoryList); } } else { $bIsInCategory = (count($aIntersec) > 0); } } return $bIsInCategory; }
[ "public", "function", "IsInCategory", "(", "$", "aCategoryList", ")", "{", "$", "bIsInCategory", "=", "false", ";", "if", "(", "in_array", "(", "$", "this", "->", "fieldShopCategoryId", ",", "$", "aCategoryList", ")", ")", "{", "$", "bIsInCategory", "=", "...
return true if the article is in at least one of the categories. @param array $aCategoryList @return bool
[ "return", "true", "if", "the", "article", "is", "in", "at", "least", "one", "of", "the", "categories", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1030-L1049
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.UpdateProductViewCount
public function UpdateProductViewCount() { if (CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS && !is_null($this->id)) { $this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_DETAIL_VIEWS, 1); } }
php
public function UpdateProductViewCount() { if (CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS && !is_null($this->id)) { $this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_DETAIL_VIEWS, 1); } }
[ "public", "function", "UpdateProductViewCount", "(", ")", "{", "if", "(", "CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS", "&&", "!", "is_null", "(", "$", "this", "->", "id", ")", ")", "{", "$", "this", "->", "getProductStatsService", "(", ")", "->", "add", "(", "$", ...
increase the product view counter by one.
[ "increase", "the", "product", "view", "counter", "by", "one", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1054-L1059
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.UpdateStatsReviews
public function UpdateStatsReviews() { $sArticleId = $this->id; if ($this->IsVariant()) { $sArticleId = $this->fieldVariantParentId; } $iCount = $this->GetReviewCount(true); $dAvrg = $this->GetReviewAverageScore(true); $this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_AVERAGE, $dAvrg); $this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_COUNT, $iCount); TCacheManager::PerformeTableChange($this->table, $sArticleId); }
php
public function UpdateStatsReviews() { $sArticleId = $this->id; if ($this->IsVariant()) { $sArticleId = $this->fieldVariantParentId; } $iCount = $this->GetReviewCount(true); $dAvrg = $this->GetReviewAverageScore(true); $this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_AVERAGE, $dAvrg); $this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_COUNT, $iCount); TCacheManager::PerformeTableChange($this->table, $sArticleId); }
[ "public", "function", "UpdateStatsReviews", "(", ")", "{", "$", "sArticleId", "=", "$", "this", "->", "id", ";", "if", "(", "$", "this", "->", "IsVariant", "(", ")", ")", "{", "$", "sArticleId", "=", "$", "this", "->", "fieldVariantParentId", ";", "}",...
updates the review stats for the article.
[ "updates", "the", "review", "stats", "for", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1064-L1075
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetMetaKeywords
public function GetMetaKeywords() { if (strlen(trim(strip_tags($this->fieldMetaKeywords))) > 0) { $aKeywords = explode(',', trim(strip_tags($this->fieldMetaKeywords))); } else { $aKeywords = explode(' ', $this->fieldName.' '.strip_tags($this->fieldDescriptionShort)); } return $aKeywords; }
php
public function GetMetaKeywords() { if (strlen(trim(strip_tags($this->fieldMetaKeywords))) > 0) { $aKeywords = explode(',', trim(strip_tags($this->fieldMetaKeywords))); } else { $aKeywords = explode(' ', $this->fieldName.' '.strip_tags($this->fieldDescriptionShort)); } return $aKeywords; }
[ "public", "function", "GetMetaKeywords", "(", ")", "{", "if", "(", "strlen", "(", "trim", "(", "strip_tags", "(", "$", "this", "->", "fieldMetaKeywords", ")", ")", ")", ">", "0", ")", "{", "$", "aKeywords", "=", "explode", "(", "','", ",", "trim", "(...
return keywords for the meta tag on article detail pages. @return array
[ "return", "keywords", "for", "the", "meta", "tag", "on", "article", "detail", "pages", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1082-L1091
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.HasVariants
public function HasVariants($bCheckForActiveVariantsOnly = false) { if ($this->IsVariant()) { return false; } $sInternalCacheKey = 'bHasVariants'; if ($bCheckForActiveVariantsOnly) { $sInternalCacheKey .= 'OnlyActive'; } $bHasVariants = &$this->GetFromInternalCache($sInternalCacheKey); if (is_null($bHasVariants)) { $bHasVariants = false; if (!empty($this->fieldShopVariantSetId)) { $oVariants = $this->GetFieldShopArticleVariantsList(array(), $bCheckForActiveVariantsOnly); $bHasVariants = (!is_null($oVariants) && $oVariants->Length() > 0); } $this->SetInternalCache($sInternalCacheKey, $bHasVariants); } return $bHasVariants; }
php
public function HasVariants($bCheckForActiveVariantsOnly = false) { if ($this->IsVariant()) { return false; } $sInternalCacheKey = 'bHasVariants'; if ($bCheckForActiveVariantsOnly) { $sInternalCacheKey .= 'OnlyActive'; } $bHasVariants = &$this->GetFromInternalCache($sInternalCacheKey); if (is_null($bHasVariants)) { $bHasVariants = false; if (!empty($this->fieldShopVariantSetId)) { $oVariants = $this->GetFieldShopArticleVariantsList(array(), $bCheckForActiveVariantsOnly); $bHasVariants = (!is_null($oVariants) && $oVariants->Length() > 0); } $this->SetInternalCache($sInternalCacheKey, $bHasVariants); } return $bHasVariants; }
[ "public", "function", "HasVariants", "(", "$", "bCheckForActiveVariantsOnly", "=", "false", ")", "{", "if", "(", "$", "this", "->", "IsVariant", "(", ")", ")", "{", "return", "false", ";", "}", "$", "sInternalCacheKey", "=", "'bHasVariants'", ";", "if", "(...
return true if the article has variants. @param bool $bCheckForActiveVariantsOnly @return bool
[ "return", "true", "if", "the", "article", "has", "variants", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1190-L1210
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetFieldShopArticleVariantsList($aSelectedTypeValues = array(), $bLoadOnlyActive = true) { $sKey = 'oFieldShopArticleVariantsList'.serialize($aSelectedTypeValues); if ($bLoadOnlyActive) { $sKey .= 'active'; } else { $sKey .= 'inactive'; } $oVariantList = &$this->GetFromInternalCache($sKey); if (is_null($oVariantList)) { if (count($aSelectedTypeValues) > 0) { $query = "SELECT `shop_article`.* FROM `shop_article` LEFT JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id` LEFT JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $aRestriction = array(); foreach ($aSelectedTypeValues as $sShopVariantTypeId => $sShopVariantTypeValueId) { $aRestriction[] = "(`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeValueId)."')"; } $query .= ' AND ('.implode(' OR ', $aRestriction).')'; if ($bLoadOnlyActive) { $sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false); if (!empty($sActiveArticleRestriction)) { $query .= ' AND ('.$sActiveArticleRestriction.')'; } } $query .= ' GROUP BY `shop_article`.`id` HAVING COUNT(`shop_article`.`id`) = '.count($aSelectedTypeValues); $oVariantList = TdbShopArticleList::GetList($query); } else { $query = "SELECT `shop_article`.* FROM `shop_article` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; if ($bLoadOnlyActive) { $sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false); if (!empty($sActiveArticleRestriction)) { $query .= ' AND ('.$sActiveArticleRestriction.')'; } } $oVariantList = TdbShopArticleList::GetList($query); } $oVariantList->bAllowItemCache = true; $this->SetInternalCache($sKey, $oVariantList); } $oVariantList->GoToStart(); return $oVariantList; }
php
public function &GetFieldShopArticleVariantsList($aSelectedTypeValues = array(), $bLoadOnlyActive = true) { $sKey = 'oFieldShopArticleVariantsList'.serialize($aSelectedTypeValues); if ($bLoadOnlyActive) { $sKey .= 'active'; } else { $sKey .= 'inactive'; } $oVariantList = &$this->GetFromInternalCache($sKey); if (is_null($oVariantList)) { if (count($aSelectedTypeValues) > 0) { $query = "SELECT `shop_article`.* FROM `shop_article` LEFT JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id` LEFT JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $aRestriction = array(); foreach ($aSelectedTypeValues as $sShopVariantTypeId => $sShopVariantTypeValueId) { $aRestriction[] = "(`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeValueId)."')"; } $query .= ' AND ('.implode(' OR ', $aRestriction).')'; if ($bLoadOnlyActive) { $sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false); if (!empty($sActiveArticleRestriction)) { $query .= ' AND ('.$sActiveArticleRestriction.')'; } } $query .= ' GROUP BY `shop_article`.`id` HAVING COUNT(`shop_article`.`id`) = '.count($aSelectedTypeValues); $oVariantList = TdbShopArticleList::GetList($query); } else { $query = "SELECT `shop_article`.* FROM `shop_article` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; if ($bLoadOnlyActive) { $sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false); if (!empty($sActiveArticleRestriction)) { $query .= ' AND ('.$sActiveArticleRestriction.')'; } } $oVariantList = TdbShopArticleList::GetList($query); } $oVariantList->bAllowItemCache = true; $this->SetInternalCache($sKey, $oVariantList); } $oVariantList->GoToStart(); return $oVariantList; }
[ "public", "function", "&", "GetFieldShopArticleVariantsList", "(", "$", "aSelectedTypeValues", "=", "array", "(", ")", ",", "$", "bLoadOnlyActive", "=", "true", ")", "{", "$", "sKey", "=", "'oFieldShopArticleVariantsList'", ".", "serialize", "(", "$", "aSelectedTy...
load list of article variants. @param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...) @param bool $bLoadOnlyActive @return TdbShopArticleList
[ "load", "list", "of", "article", "variants", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1220-L1271
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetLowestPricedVariant
public function GetLowestPricedVariant() { $oLowestPrictedVariant = null; $oVariants = $this->GetFieldShopArticleVariantsList(); while ($oVariant = $oVariants->Next()) { if (is_null($oLowestPrictedVariant) || $oVariant->fieldPrice < $oLowestPrictedVariant->fieldPrice) { $oLowestPrictedVariant = $oVariant; } } return $oLowestPrictedVariant; }
php
public function GetLowestPricedVariant() { $oLowestPrictedVariant = null; $oVariants = $this->GetFieldShopArticleVariantsList(); while ($oVariant = $oVariants->Next()) { if (is_null($oLowestPrictedVariant) || $oVariant->fieldPrice < $oLowestPrictedVariant->fieldPrice) { $oLowestPrictedVariant = $oVariant; } } return $oLowestPrictedVariant; }
[ "public", "function", "GetLowestPricedVariant", "(", ")", "{", "$", "oLowestPrictedVariant", "=", "null", ";", "$", "oVariants", "=", "$", "this", "->", "GetFieldShopArticleVariantsList", "(", ")", ";", "while", "(", "$", "oVariant", "=", "$", "oVariants", "->...
return variant with the lowest price. @return TdbShopArticle
[ "return", "variant", "with", "the", "lowest", "price", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1278-L1290
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.getVariantIDList
public function getVariantIDList($aSelectedTypeValues = array(), $bLoadActiveOnly = true) { $aArticleIdList = array(); $oVariantList = null; if ($this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oVariantList = $oParent->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly); } else { $oVariantList = $this->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly); } if ($oVariantList->Length() > 0) { $oVariantList->GoToStart(); while ($oVariantArticle = $oVariantList->Next()) { $aArticleIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oVariantArticle->id); } } return $aArticleIdList; }
php
public function getVariantIDList($aSelectedTypeValues = array(), $bLoadActiveOnly = true) { $aArticleIdList = array(); $oVariantList = null; if ($this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oVariantList = $oParent->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly); } else { $oVariantList = $this->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly); } if ($oVariantList->Length() > 0) { $oVariantList->GoToStart(); while ($oVariantArticle = $oVariantList->Next()) { $aArticleIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oVariantArticle->id); } } return $aArticleIdList; }
[ "public", "function", "getVariantIDList", "(", "$", "aSelectedTypeValues", "=", "array", "(", ")", ",", "$", "bLoadActiveOnly", "=", "true", ")", "{", "$", "aArticleIdList", "=", "array", "(", ")", ";", "$", "oVariantList", "=", "null", ";", "if", "(", "...
returns an array of IDs of all variant articles of this article. @param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...) @param bool $bLoadActiveOnly - set to false if you want to load inactive articles too @return array
[ "returns", "an", "array", "of", "IDs", "of", "all", "variant", "articles", "of", "this", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1322-L1341
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetVariantValuesAvailableForType
public function GetVariantValuesAvailableForType($oVariantType, $aSelectedTypeValues = array()) { $oVariantValueList = null; $aArticleIdList = $this->getVariantIDList($aSelectedTypeValues, true); if (count($aArticleIdList) > 0) { $query = "SELECT `shop_variant_type_value`.* FROM `shop_variant_type_value` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id` WHERE `shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->id)."' AND `shop_article_shop_variant_type_value_mlt`.`source_id` IN ('".implode("','", $aArticleIdList)."') GROUP BY `shop_variant_type_value`.`id` ORDER BY `shop_variant_type_value`.`".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->fieldShopVariantTypeValueCmsfieldname).'` '; $oVariantValueList = TdbShopVariantTypeValueList::GetList($query); } return $oVariantValueList; }
php
public function GetVariantValuesAvailableForType($oVariantType, $aSelectedTypeValues = array()) { $oVariantValueList = null; $aArticleIdList = $this->getVariantIDList($aSelectedTypeValues, true); if (count($aArticleIdList) > 0) { $query = "SELECT `shop_variant_type_value`.* FROM `shop_variant_type_value` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id` WHERE `shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->id)."' AND `shop_article_shop_variant_type_value_mlt`.`source_id` IN ('".implode("','", $aArticleIdList)."') GROUP BY `shop_variant_type_value`.`id` ORDER BY `shop_variant_type_value`.`".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->fieldShopVariantTypeValueCmsfieldname).'` '; $oVariantValueList = TdbShopVariantTypeValueList::GetList($query); } return $oVariantValueList; }
[ "public", "function", "GetVariantValuesAvailableForType", "(", "$", "oVariantType", ",", "$", "aSelectedTypeValues", "=", "array", "(", ")", ")", "{", "$", "oVariantValueList", "=", "null", ";", "$", "aArticleIdList", "=", "$", "this", "->", "getVariantIDList", ...
return all variant values that are available for the given type and this article. @param TdbShopVariantType $oVariantType @param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...) @return TdbShopVariantTypeValueList
[ "return", "all", "variant", "values", "that", "are", "available", "for", "the", "given", "type", "and", "this", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1351-L1370
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetActiveVariantValue
public function GetActiveVariantValue($sVariantTypeIdentifier) { $oVariantValueObject = null; $aVariantValues = &$this->GetFromInternalCache('aActiveVariantValues'); if (is_null($aVariantValues)) { $query = "SELECT `shop_variant_type_value`.*, `shop_variant_type`.`identifier` AS variantTypeName FROM `shop_variant_type_value` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id` INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id` WHERE `shop_article_shop_variant_type_value_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $oVariantValues = TdbShopVariantTypeValueList::GetList($query); while ($oVariantValue = $oVariantValues->Next()) { $aVariantValues[$oVariantValue->sqlData['variantTypeName']] = $oVariantValue; } $this->SetInternalCache('aActiveVariantValues', $aVariantValues); } if (is_array($aVariantValues) && array_key_exists($sVariantTypeIdentifier, $aVariantValues)) { $oVariantValueObject = $aVariantValues[$sVariantTypeIdentifier]; } return $oVariantValueObject; }
php
public function GetActiveVariantValue($sVariantTypeIdentifier) { $oVariantValueObject = null; $aVariantValues = &$this->GetFromInternalCache('aActiveVariantValues'); if (is_null($aVariantValues)) { $query = "SELECT `shop_variant_type_value`.*, `shop_variant_type`.`identifier` AS variantTypeName FROM `shop_variant_type_value` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id` INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id` WHERE `shop_article_shop_variant_type_value_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $oVariantValues = TdbShopVariantTypeValueList::GetList($query); while ($oVariantValue = $oVariantValues->Next()) { $aVariantValues[$oVariantValue->sqlData['variantTypeName']] = $oVariantValue; } $this->SetInternalCache('aActiveVariantValues', $aVariantValues); } if (is_array($aVariantValues) && array_key_exists($sVariantTypeIdentifier, $aVariantValues)) { $oVariantValueObject = $aVariantValues[$sVariantTypeIdentifier]; } return $oVariantValueObject; }
[ "public", "function", "GetActiveVariantValue", "(", "$", "sVariantTypeIdentifier", ")", "{", "$", "oVariantValueObject", "=", "null", ";", "$", "aVariantValues", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "'aActiveVariantValues'", ")", ";", "if", "(...
returns the variant type value for the given identifier. note: there was a typo in the method name GetActiveVaraintValue please change your custom code to use the renamed method (the old method name is redirected, but will be removed in the future) @param string $sVariantTypeIdentifier @return TdbShopVariantTypeValue - returns null if $sVariantTypeIdentifier was not found
[ "returns", "the", "variant", "type", "value", "for", "the", "given", "identifier", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1465-L1487
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetVariantTypeActiveValue
public function GetVariantTypeActiveValue($sVariantTypeId) { $sValue = false; $aVariantValueIds = $this->GetFromInternalCache('aActiveVariantValueIds'); if (is_null($aVariantValueIds)) { $oValueList = &$this->GetFieldShopVariantTypeValueList(); while ($oValue = $oValueList->Next()) { $aVariantValueIds[$oValue->fieldShopVariantTypeId] = $oValue->id; } $oValueList->GoToStart(); $this->SetInternalCache('aActiveVariantValueIds', $aVariantValueIds); } if (is_array($aVariantValueIds) && array_key_exists($sVariantTypeId, $aVariantValueIds)) { $sValue = $aVariantValueIds[$sVariantTypeId]; } return $sValue; }
php
public function GetVariantTypeActiveValue($sVariantTypeId) { $sValue = false; $aVariantValueIds = $this->GetFromInternalCache('aActiveVariantValueIds'); if (is_null($aVariantValueIds)) { $oValueList = &$this->GetFieldShopVariantTypeValueList(); while ($oValue = $oValueList->Next()) { $aVariantValueIds[$oValue->fieldShopVariantTypeId] = $oValue->id; } $oValueList->GoToStart(); $this->SetInternalCache('aActiveVariantValueIds', $aVariantValueIds); } if (is_array($aVariantValueIds) && array_key_exists($sVariantTypeId, $aVariantValueIds)) { $sValue = $aVariantValueIds[$sVariantTypeId]; } return $sValue; }
[ "public", "function", "GetVariantTypeActiveValue", "(", "$", "sVariantTypeId", ")", "{", "$", "sValue", "=", "false", ";", "$", "aVariantValueIds", "=", "$", "this", "->", "GetFromInternalCache", "(", "'aActiveVariantValueIds'", ")", ";", "if", "(", "is_null", "...
returns the id of the active value for the given variant type. @param string $sVariantTypeId @return string
[ "returns", "the", "id", "of", "the", "active", "value", "for", "the", "given", "variant", "type", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1496-L1513
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.RenderVariantSelection
public function RenderVariantSelection($sViewName = 'vStandard', $sViewType = 'Customer') { $sHTML = ''; $oVariantSet = null; if ($this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oVariantSet = &$oParent->GetFieldShopVariantSet(); } else { $oVariantSet = &$this->GetFieldShopVariantSet(); } if (!is_null($oVariantSet)) { $oHandler = $oVariantSet->GetFieldShopVariantDisplayHandler(); $sHTML = $oHandler->Render($this, $sViewName, $sViewType); } return $sHTML; }
php
public function RenderVariantSelection($sViewName = 'vStandard', $sViewType = 'Customer') { $sHTML = ''; $oVariantSet = null; if ($this->IsVariant()) { $oParent = &$this->GetFieldVariantParent(); $oVariantSet = &$oParent->GetFieldShopVariantSet(); } else { $oVariantSet = &$this->GetFieldShopVariantSet(); } if (!is_null($oVariantSet)) { $oHandler = $oVariantSet->GetFieldShopVariantDisplayHandler(); $sHTML = $oHandler->Render($this, $sViewName, $sViewType); } return $sHTML; }
[ "public", "function", "RenderVariantSelection", "(", "$", "sViewName", "=", "'vStandard'", ",", "$", "sViewType", "=", "'Customer'", ")", "{", "$", "sHTML", "=", "''", ";", "$", "oVariantSet", "=", "null", ";", "if", "(", "$", "this", "->", "IsVariant", ...
render the variant selection html using the display handler defined through the variant set. @param string $sViewName @param string $sViewType @return string
[ "render", "the", "variant", "selection", "html", "using", "the", "display", "handler", "defined", "through", "the", "variant", "set", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1523-L1540
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetVariantFromValues
public function GetVariantFromValues($aTypeValuePairs) { $oArticle = null; if (!$this->IsVariant()) { $query = "SELECT `shop_article`.* FROM `shop_article` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id` INNER JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $aParts = array(); foreach ($aTypeValuePairs as $sVariantTypeId => $sVariantTypeValueId) { $aParts[] = "`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeValueId)."'"; } $query .= ' AND ('.implode(') OR (', $aParts).')'; $query .= ' GROUP BY `shop_article`.`id`'; $query .= ' HAVING COUNT(`shop_article`.`id`) = '.MySqlLegacySupport::getInstance()->real_escape_string(count($aParts)); $query .= ' ORDER BY `shop_article`.`active` DESC'; //we want the active article if multiple present if ($aMatch = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aMatch); } } return $oArticle; }
php
public function GetVariantFromValues($aTypeValuePairs) { $oArticle = null; if (!$this->IsVariant()) { $query = "SELECT `shop_article`.* FROM `shop_article` INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id` INNER JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id` WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $aParts = array(); foreach ($aTypeValuePairs as $sVariantTypeId => $sVariantTypeValueId) { $aParts[] = "`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeValueId)."'"; } $query .= ' AND ('.implode(') OR (', $aParts).')'; $query .= ' GROUP BY `shop_article`.`id`'; $query .= ' HAVING COUNT(`shop_article`.`id`) = '.MySqlLegacySupport::getInstance()->real_escape_string(count($aParts)); $query .= ' ORDER BY `shop_article`.`active` DESC'; //we want the active article if multiple present if ($aMatch = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aMatch); } } return $oArticle; }
[ "public", "function", "GetVariantFromValues", "(", "$", "aTypeValuePairs", ")", "{", "$", "oArticle", "=", "null", ";", "if", "(", "!", "$", "this", "->", "IsVariant", "(", ")", ")", "{", "$", "query", "=", "\"SELECT `shop_article`.*\n FROM `s...
return the variant matching the shop_variant_type_value paris. @param array $aTypeValuePairs @return TdbShopArticle
[ "return", "the", "variant", "matching", "the", "shop_variant_type_value", "paris", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1549-L1574
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetMessageConsumerName
public function GetMessageConsumerName() { $sId = $this->id; if ($this->IsVariant()) { $sId = $this->fieldVariantParentId; } return TdbShopArticle::MSG_CONSUMER_BASE_NAME.$sId; }
php
public function GetMessageConsumerName() { $sId = $this->id; if ($this->IsVariant()) { $sId = $this->fieldVariantParentId; } return TdbShopArticle::MSG_CONSUMER_BASE_NAME.$sId; }
[ "public", "function", "GetMessageConsumerName", "(", ")", "{", "$", "sId", "=", "$", "this", "->", "id", ";", "if", "(", "$", "this", "->", "IsVariant", "(", ")", ")", "{", "$", "sId", "=", "$", "this", "->", "fieldVariantParentId", ";", "}", "return...
return the message consumer name of this article. note that varaints always talk through their parents - so if you want to talk to the variant directly, you will need to overwrite this method. @return string
[ "return", "the", "message", "consumer", "name", "of", "this", "article", ".", "note", "that", "varaints", "always", "talk", "through", "their", "parents", "-", "so", "if", "you", "want", "to", "talk", "to", "the", "variant", "directly", "you", "will", "nee...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1617-L1625
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetFieldShopBundleArticleList() { $oBundleList = parent::GetFieldShopBundleArticleList(); if (0 == $oBundleList->Length() && $this->IsVariant()) { $oBundleList = $this->GetFieldVariantParent()->GetFieldShopBundleArticleList(); } $oBundleList->bAllowItemCache = true; return $oBundleList; }
php
public function &GetFieldShopBundleArticleList() { $oBundleList = parent::GetFieldShopBundleArticleList(); if (0 == $oBundleList->Length() && $this->IsVariant()) { $oBundleList = $this->GetFieldVariantParent()->GetFieldShopBundleArticleList(); } $oBundleList->bAllowItemCache = true; return $oBundleList; }
[ "public", "function", "&", "GetFieldShopBundleArticleList", "(", ")", "{", "$", "oBundleList", "=", "parent", "::", "GetFieldShopBundleArticleList", "(", ")", ";", "if", "(", "0", "==", "$", "oBundleList", "->", "Length", "(", ")", "&&", "$", "this", "->", ...
Get bundle article list - if we are a variant an no bundle articles are set, the we return the bundles of the parent. @return TdbShopBundleArticleList
[ "Get", "bundle", "article", "list", "-", "if", "we", "are", "a", "variant", "an", "no", "bundle", "articles", "are", "set", "the", "we", "return", "the", "bundles", "of", "the", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1632-L1641
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetFieldShopAttributeValueList
public function GetFieldShopAttributeValueList($sOrderBy = '') { $oAttributeValueList = parent::GetFieldShopAttributeValueList($sOrderBy); if (0 == $oAttributeValueList->Length() && $this->IsVariant()) { $oAttributeValueList = $this->GetFieldVariantParent()->GetFieldShopAttributeValueList($sOrderBy); } $oAttributeValueList->bAllowItemCache = true; return $oAttributeValueList; }
php
public function GetFieldShopAttributeValueList($sOrderBy = '') { $oAttributeValueList = parent::GetFieldShopAttributeValueList($sOrderBy); if (0 == $oAttributeValueList->Length() && $this->IsVariant()) { $oAttributeValueList = $this->GetFieldVariantParent()->GetFieldShopAttributeValueList($sOrderBy); } $oAttributeValueList->bAllowItemCache = true; return $oAttributeValueList; }
[ "public", "function", "GetFieldShopAttributeValueList", "(", "$", "sOrderBy", "=", "''", ")", "{", "$", "oAttributeValueList", "=", "parent", "::", "GetFieldShopAttributeValueList", "(", "$", "sOrderBy", ")", ";", "if", "(", "0", "==", "$", "oAttributeValueList", ...
get article attribute value list - if we are a variant and no attribute values are set, then we return the attribute values of the parent. @param string $sOrderBy - an sql order by string (without the order by) @return TdbShopAttributeValueList
[ "get", "article", "attribute", "value", "list", "-", "if", "we", "are", "a", "variant", "and", "no", "attribute", "values", "are", "set", "then", "we", "return", "the", "attribute", "values", "of", "the", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1670-L1679
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.GetSeoPattern
public function GetSeoPattern(&$sPaternIn) { //$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]"; //default $aPatRepl = null; if (!empty($this->sqlData['seo_pattern'])) { $sPaternIn = $this->sqlData['seo_pattern']; } $aPatRepl = array(); $activePage = $this->getActivePageService()->getActivePage(); $aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle(); $activeCategory = $this->getShopService()->getActiveCategory(); if (is_object($activeCategory)) { $aPatRepl['CATEGORY_NAME'] = $activeCategory->GetName(); } $oManufacturer = $this->GetFieldShopManufacturer(); if (is_object($oManufacturer)) { $aPatRepl['MANUFACTURER_NAME'] = $oManufacturer->GetName(); } $aPatRepl['ARTICLE_NAME'] = $this->GetName(); return $aPatRepl; }
php
public function GetSeoPattern(&$sPaternIn) { //$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]"; //default $aPatRepl = null; if (!empty($this->sqlData['seo_pattern'])) { $sPaternIn = $this->sqlData['seo_pattern']; } $aPatRepl = array(); $activePage = $this->getActivePageService()->getActivePage(); $aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle(); $activeCategory = $this->getShopService()->getActiveCategory(); if (is_object($activeCategory)) { $aPatRepl['CATEGORY_NAME'] = $activeCategory->GetName(); } $oManufacturer = $this->GetFieldShopManufacturer(); if (is_object($oManufacturer)) { $aPatRepl['MANUFACTURER_NAME'] = $oManufacturer->GetName(); } $aPatRepl['ARTICLE_NAME'] = $this->GetName(); return $aPatRepl; }
[ "public", "function", "GetSeoPattern", "(", "&", "$", "sPaternIn", ")", "{", "//$sPaternIn = \"[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]\"; //default", "$", "aPatRepl", "=", "null", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "sqlData", "[", "...
Get SEO pattern of current article. @param string $sPaternIn SEO pattern string @return array SEO pattern replace values
[ "Get", "SEO", "pattern", "of", "current", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1724-L1750
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.UpdateStock
public function UpdateStock($dNewStockValue, $bNewAmountIsDelta = false, $bUpdateSaleCounter = false, $bForceUpdate = false) { if ($this->HasVariants()) { return false; } $oldStock = $this->getAvailableStock(); // NOTE the below comparison always has true as result (compares int to double); see https://github.com/chameleon-system/chameleon-system/issues/120 $stockIsChanging = ($bNewAmountIsDelta || $oldStock !== $dNewStockValue); if (false === $stockIsChanging && false === $bUpdateSaleCounter && false === $bForceUpdate) { return false; } if ($bNewAmountIsDelta) { $this->getInventoryService()->addStock($this->id, $dNewStockValue); } else { $this->getInventoryService()->setStock($this->id, $dNewStockValue); } if ($bUpdateSaleCounter && $bNewAmountIsDelta) { $dSaleAmount = -1 * $dNewStockValue; $this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_SALES, $dSaleAmount); } $newStock = $this->getAvailableStock(); $bActive = $this->CheckActivateOrDeactivate($newStock); $this->setIsActive(1 === $bActive); // check if the article is part of a bundle... if it is, make sure the bundle article does not exceed the total number of single items $query = 'SELECT shop_article.*, shop_bundle_article.amount AS ItemsPerBundle, (shop_bundle_article.amount * shop_article_stock.amount) AS required_stock FROM shop_article INNER JOIN shop_bundle_article ON shop_article.id = shop_bundle_article.shop_article_id LEFT JOIN shop_article_stock ON shop_article.id = shop_article_stock.shop_article_id WHERE shop_bundle_article.bundle_article_id = :articleId AND (shop_bundle_article.amount * shop_article_stock.amount) > :newStock '; $aBundleChangeList = $this->getDatabaseConnection()->fetchAll($query, array('articleId' => $this->id, 'newStock' => $newStock), array('articleId' => \PDO::PARAM_STR, 'newStock' => \PDO::PARAM_INT)); foreach ($aBundleChangeList as $aBundleChange) { $iAllowedStock = floor($newStock / $aBundleChange['ItemsPerBundle']); $oBundleArticle = TdbShopArticle::GetNewInstance(); $oBundleArticle->LoadFromRow($aBundleChange); $oBundleArticle->UpdateStock($iAllowedStock, false, false); } if ($oldStock !== $newStock || true === $bForceUpdate) { $this->StockWasUpdatedHook($oldStock, $newStock); $this->getEventDispatcher()->dispatch(ShopEvents::UPDATE_PRODUCT_STOCK, new UpdateProductStockEvent($this->id, $newStock, $oldStock)); } return $oldStock !== $newStock; }
php
public function UpdateStock($dNewStockValue, $bNewAmountIsDelta = false, $bUpdateSaleCounter = false, $bForceUpdate = false) { if ($this->HasVariants()) { return false; } $oldStock = $this->getAvailableStock(); // NOTE the below comparison always has true as result (compares int to double); see https://github.com/chameleon-system/chameleon-system/issues/120 $stockIsChanging = ($bNewAmountIsDelta || $oldStock !== $dNewStockValue); if (false === $stockIsChanging && false === $bUpdateSaleCounter && false === $bForceUpdate) { return false; } if ($bNewAmountIsDelta) { $this->getInventoryService()->addStock($this->id, $dNewStockValue); } else { $this->getInventoryService()->setStock($this->id, $dNewStockValue); } if ($bUpdateSaleCounter && $bNewAmountIsDelta) { $dSaleAmount = -1 * $dNewStockValue; $this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_SALES, $dSaleAmount); } $newStock = $this->getAvailableStock(); $bActive = $this->CheckActivateOrDeactivate($newStock); $this->setIsActive(1 === $bActive); // check if the article is part of a bundle... if it is, make sure the bundle article does not exceed the total number of single items $query = 'SELECT shop_article.*, shop_bundle_article.amount AS ItemsPerBundle, (shop_bundle_article.amount * shop_article_stock.amount) AS required_stock FROM shop_article INNER JOIN shop_bundle_article ON shop_article.id = shop_bundle_article.shop_article_id LEFT JOIN shop_article_stock ON shop_article.id = shop_article_stock.shop_article_id WHERE shop_bundle_article.bundle_article_id = :articleId AND (shop_bundle_article.amount * shop_article_stock.amount) > :newStock '; $aBundleChangeList = $this->getDatabaseConnection()->fetchAll($query, array('articleId' => $this->id, 'newStock' => $newStock), array('articleId' => \PDO::PARAM_STR, 'newStock' => \PDO::PARAM_INT)); foreach ($aBundleChangeList as $aBundleChange) { $iAllowedStock = floor($newStock / $aBundleChange['ItemsPerBundle']); $oBundleArticle = TdbShopArticle::GetNewInstance(); $oBundleArticle->LoadFromRow($aBundleChange); $oBundleArticle->UpdateStock($iAllowedStock, false, false); } if ($oldStock !== $newStock || true === $bForceUpdate) { $this->StockWasUpdatedHook($oldStock, $newStock); $this->getEventDispatcher()->dispatch(ShopEvents::UPDATE_PRODUCT_STOCK, new UpdateProductStockEvent($this->id, $newStock, $oldStock)); } return $oldStock !== $newStock; }
[ "public", "function", "UpdateStock", "(", "$", "dNewStockValue", ",", "$", "bNewAmountIsDelta", "=", "false", ",", "$", "bUpdateSaleCounter", "=", "false", ",", "$", "bForceUpdate", "=", "false", ")", "{", "if", "(", "$", "this", "->", "HasVariants", "(", ...
the methods recalculates the total available stock for a base article based on the articles variants. You can call this either on the primary article or on a variant - both calls will result in an update to the parent article. @param float $dNewStockValue - optional: you can update the stock of the current article to this new value @param bool $bNewAmountIsDelta - set to true if you want to increase or decrease the amount by some quantity @param bool $bUpdateSaleCounter - set to true if you also want to update the sales counter (IMPORTANT: changes the sales counter ONLY if $bNewAmountIsDelta is also set to true) @param bool $bForceUpdate - set to true, if you want to trigger update action, even if nothing changed (needed for example, if an article is changed via the table editor) @return bool - return true if some data was changed
[ "the", "methods", "recalculates", "the", "total", "available", "stock", "for", "a", "base", "article", "based", "on", "the", "articles", "variants", ".", "You", "can", "call", "this", "either", "on", "the", "primary", "article", "or", "on", "a", "variant", ...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1819-L1871
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.CheckActivateOrDeactivate
public function CheckActivateOrDeactivate($dNewStockValue = null) { if (null === $dNewStockValue) { $dNewStockValue = $this->getAvailableStock(); } $isActive = 0; if ($this->fieldActive) { $isActive = 1; } $oStockMessage = &$this->GetFieldShopStockMessage(); if ($oStockMessage) { if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) { $isActive = 1; } if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) { $isActive = 0; } } return $isActive; }
php
public function CheckActivateOrDeactivate($dNewStockValue = null) { if (null === $dNewStockValue) { $dNewStockValue = $this->getAvailableStock(); } $isActive = 0; if ($this->fieldActive) { $isActive = 1; } $oStockMessage = &$this->GetFieldShopStockMessage(); if ($oStockMessage) { if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) { $isActive = 1; } if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) { $isActive = 0; } } return $isActive; }
[ "public", "function", "CheckActivateOrDeactivate", "(", "$", "dNewStockValue", "=", "null", ")", "{", "if", "(", "null", "===", "$", "dNewStockValue", ")", "{", "$", "dNewStockValue", "=", "$", "this", "->", "getAvailableStock", "(", ")", ";", "}", "$", "i...
checks if we would deactivate the article if the stock of the article was dNewStockValue returns 1 if the article remains active, 0 if it would be deactivated. @param float $dNewStockValue - the stock we want to check the state of the article for @return int
[ "checks", "if", "we", "would", "deactivate", "the", "article", "if", "the", "stock", "of", "the", "article", "was", "dNewStockValue", "returns", "1", "if", "the", "article", "remains", "active", "0", "if", "it", "would", "be", "deactivated", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1973-L1993
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.&
public function &GetFieldShopStockMessage() { $oItem = $this->GetFromInternalCache('oLookupshop_stock_message_id'); if (null === $oItem) { $oItem = $this->getShopStockMessageDataAccess()->getStockMessage($this->fieldShopStockMessageId, $this->iLanguageId); if (null !== $oItem) { $this->SetInternalCache('oLookupshop_stock_message_id', $oItem); } } if (null !== $oItem && false === $oItem->GetArticle()) { $oItem->SetArticle($this); } if (null !== $oItem && false === is_array($oItem->sqlData)) { $oItem = null; } return $oItem; }
php
public function &GetFieldShopStockMessage() { $oItem = $this->GetFromInternalCache('oLookupshop_stock_message_id'); if (null === $oItem) { $oItem = $this->getShopStockMessageDataAccess()->getStockMessage($this->fieldShopStockMessageId, $this->iLanguageId); if (null !== $oItem) { $this->SetInternalCache('oLookupshop_stock_message_id', $oItem); } } if (null !== $oItem && false === $oItem->GetArticle()) { $oItem->SetArticle($this); } if (null !== $oItem && false === is_array($oItem->sqlData)) { $oItem = null; } return $oItem; }
[ "public", "function", "&", "GetFieldShopStockMessage", "(", ")", "{", "$", "oItem", "=", "$", "this", "->", "GetFromInternalCache", "(", "'oLookupshop_stock_message_id'", ")", ";", "if", "(", "null", "===", "$", "oItem", ")", "{", "$", "oItem", "=", "$", "...
the method gets the shopstockmessage for the current article. @return TdbShopStockMessage|null
[ "the", "method", "gets", "the", "shopstockmessage", "for", "the", "current", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L2008-L2026
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticle.class.php
TShopArticle.getToBasketLinkOtherParameters
private function getToBasketLinkOtherParameters($aParameters = array()) { $aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters(); foreach ($aParameters as $sKey => $sVal) { $aExcludeParameters[] = $sKey; } // now add all OTHER parameters $aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters); foreach ($aOtherParameters as $sKey => $sVal) { $aParameters[$sKey] = $sVal; } return $aParameters; }
php
private function getToBasketLinkOtherParameters($aParameters = array()) { $aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters(); foreach ($aParameters as $sKey => $sVal) { $aExcludeParameters[] = $sKey; } // now add all OTHER parameters $aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters); foreach ($aOtherParameters as $sKey => $sVal) { $aParameters[$sKey] = $sVal; } return $aParameters; }
[ "private", "function", "getToBasketLinkOtherParameters", "(", "$", "aParameters", "=", "array", "(", ")", ")", "{", "$", "aExcludeParameters", "=", "TCMSSmartURLData", "::", "GetActive", "(", ")", "->", "getSeoURLParameters", "(", ")", ";", "foreach", "(", "$", ...
Get all post and get parameters an add them to parameter list. @param array $aParameters @return array
[ "Get", "all", "post", "and", "get", "parameters", "an", "add", "them", "to", "parameter", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L2206-L2221
train
PGB-LIV/php-ms
src/Writer/MgfWriter.php
MgfWriter.write
public function write(PrecursorIon $precursor) { if (is_null($this->fileHandle)) { throw new \BadMethodCallException('The file handle is closed. Cannot write after close() has been called.'); } // TODO: Validate mandatory/optional fields fwrite($this->fileHandle, 'BEGIN IONS' . PHP_EOL); fwrite($this->fileHandle, 'TITLE=' . $precursor->getTitle() . PHP_EOL); fwrite($this->fileHandle, 'PEPMASS=' . $precursor->getMonoisotopicMassCharge()); if (! is_null($precursor->getIntensity())) { fwrite($this->fileHandle, ' ' . $precursor->getIntensity()); } fwrite($this->fileHandle, PHP_EOL); fwrite($this->fileHandle, 'CHARGE=' . $precursor->getCharge() . '+' . PHP_EOL); if (! is_null($precursor->getScan())) { fwrite($this->fileHandle, 'SCANS=' . $precursor->getScan() . PHP_EOL); } if (! is_null($precursor->getRetentionTime())) { if ($precursor->hasRetentionTimeWindow()) { fwrite($this->fileHandle, 'RTINSECONDS=' . implode(',', $precursor->getRetentionTimeWindow()) . PHP_EOL); } else { fwrite($this->fileHandle, 'RTINSECONDS=' . $precursor->getRetentionTime() . PHP_EOL); } } foreach ($precursor->getFragmentIons() as $ion) { fwrite($this->fileHandle, $ion->getMonoisotopicMassCharge() . ' '); fwrite($this->fileHandle, $ion->getIntensity()); if (! is_null($ion->getCharge()) && $ion->getCharge() != 1) { fwrite($this->fileHandle, ' ' . $ion->getCharge()); } fwrite($this->fileHandle, PHP_EOL); } fwrite($this->fileHandle, 'END IONS' . PHP_EOL); }
php
public function write(PrecursorIon $precursor) { if (is_null($this->fileHandle)) { throw new \BadMethodCallException('The file handle is closed. Cannot write after close() has been called.'); } // TODO: Validate mandatory/optional fields fwrite($this->fileHandle, 'BEGIN IONS' . PHP_EOL); fwrite($this->fileHandle, 'TITLE=' . $precursor->getTitle() . PHP_EOL); fwrite($this->fileHandle, 'PEPMASS=' . $precursor->getMonoisotopicMassCharge()); if (! is_null($precursor->getIntensity())) { fwrite($this->fileHandle, ' ' . $precursor->getIntensity()); } fwrite($this->fileHandle, PHP_EOL); fwrite($this->fileHandle, 'CHARGE=' . $precursor->getCharge() . '+' . PHP_EOL); if (! is_null($precursor->getScan())) { fwrite($this->fileHandle, 'SCANS=' . $precursor->getScan() . PHP_EOL); } if (! is_null($precursor->getRetentionTime())) { if ($precursor->hasRetentionTimeWindow()) { fwrite($this->fileHandle, 'RTINSECONDS=' . implode(',', $precursor->getRetentionTimeWindow()) . PHP_EOL); } else { fwrite($this->fileHandle, 'RTINSECONDS=' . $precursor->getRetentionTime() . PHP_EOL); } } foreach ($precursor->getFragmentIons() as $ion) { fwrite($this->fileHandle, $ion->getMonoisotopicMassCharge() . ' '); fwrite($this->fileHandle, $ion->getIntensity()); if (! is_null($ion->getCharge()) && $ion->getCharge() != 1) { fwrite($this->fileHandle, ' ' . $ion->getCharge()); } fwrite($this->fileHandle, PHP_EOL); } fwrite($this->fileHandle, 'END IONS' . PHP_EOL); }
[ "public", "function", "write", "(", "PrecursorIon", "$", "precursor", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "fileHandle", ")", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "'The file handle is closed. Cannot write after close() ha...
Writes the precursor ion and it's associated fragments to the file associated with this instance @param PrecursorIon $precursor The precursor ion to write
[ "Writes", "the", "precursor", "ion", "and", "it", "s", "associated", "fragments", "to", "the", "file", "associated", "with", "this", "instance" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Writer/MgfWriter.php#L55-L96
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php
TShopVariantDisplayHandler.GetInstance
public static function GetInstance($sId) { $oRealObject = null; $oObject = TdbShopVariantDisplayHandler::GetNewInstance(); /** @var $oObject TdbShopVariantDisplayHandler */ if ($oObject->Load($sId)) { $sClassName = $oObject->fieldClass; $oRealObject = new $sClassName(); $oRealObject->LoadFromRow($oObject->sqlData); } return $oRealObject; }
php
public static function GetInstance($sId) { $oRealObject = null; $oObject = TdbShopVariantDisplayHandler::GetNewInstance(); /** @var $oObject TdbShopVariantDisplayHandler */ if ($oObject->Load($sId)) { $sClassName = $oObject->fieldClass; $oRealObject = new $sClassName(); $oRealObject->LoadFromRow($oObject->sqlData); } return $oRealObject; }
[ "public", "static", "function", "GetInstance", "(", "$", "sId", ")", "{", "$", "oRealObject", "=", "null", ";", "$", "oObject", "=", "TdbShopVariantDisplayHandler", "::", "GetNewInstance", "(", ")", ";", "/** @var $oObject TdbShopVariantDisplayHandler */", "if", "("...
return an instance of the handler type for the given id. @param string $sId @example TdbShopVariantDisplayHandler
[ "return", "an", "instance", "of", "the", "handler", "type", "for", "the", "given", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php#L23-L35
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php
TShopVariantDisplayHandler.GetArticleMatchingCurrentSelection
public static function GetArticleMatchingCurrentSelection(TdbShopArticle &$oParentArticle, $bOnlyIfAPartialSelectionExists = true) { $aActiveSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true); if (!$bOnlyIfAPartialSelectionExists || (is_array($aActiveSelection) && count($aActiveSelection))) { return $oParentArticle->GetVariantFromValues($aActiveSelection); } else { return null; } }
php
public static function GetArticleMatchingCurrentSelection(TdbShopArticle &$oParentArticle, $bOnlyIfAPartialSelectionExists = true) { $aActiveSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true); if (!$bOnlyIfAPartialSelectionExists || (is_array($aActiveSelection) && count($aActiveSelection))) { return $oParentArticle->GetVariantFromValues($aActiveSelection); } else { return null; } }
[ "public", "static", "function", "GetArticleMatchingCurrentSelection", "(", "TdbShopArticle", "&", "$", "oParentArticle", ",", "$", "bOnlyIfAPartialSelectionExists", "=", "true", ")", "{", "$", "aActiveSelection", "=", "TdbShopVariantDisplayHandler", "::", "GetActiveVariantT...
return the first article matchin the current selection given a parent article this can be usefull if a user has selected color but not size for a clothing article and you want to display the images of the color variant. @param TdbShopArticle $oParentArticle @param bool $bOnlyIfAPartialSelectionExists - set to true if you also want to fetch the first variant if no user selection (such as color) exists @return TdbShopArticle
[ "return", "the", "first", "article", "matchin", "the", "current", "selection", "given", "a", "parent", "article", "this", "can", "be", "usefull", "if", "a", "user", "has", "selected", "color", "but", "not", "size", "for", "a", "clothing", "article", "and", ...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php#L127-L135
train
PGB-LIV/php-ms
src/Search/Parameters/MsgfPlusSearchParameters.php
MsgfPlusSearchParameters.createModificationFile
public static function createModificationFile(array $modifications, $numMods = 2) { // TODO: // All array must be this class // NumMods must be uint $data = 'NumMods=' . $numMods . PHP_EOL; foreach ($modifications as $modification) { $entry = $modification->getMonoisotopicMass() . ','; $entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues()); $entry .= ','; $entry .= $modification->isFixed() ? 'fix,' : 'opt,'; $position = ''; switch ($modification->getPosition()) { case Modification::POSITION_PROTEIN_NTERM: $position = 'Prot-N-term'; break; case Modification::POSITION_PROTEIN_CTERM: $position = 'Prot-C-term'; break; case Modification::POSITION_NTERM: $position = 'N-term'; break; case Modification::POSITION_CTERM: $position = 'C-term'; break; case Modification::POSITION_ANY: default: $position = 'any'; break; } $entry .= $position . ','; $entry .= $modification->getName(); $data .= $entry . PHP_EOL; } $modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods'); file_put_contents($modFile, $data); return $modFile; }
php
public static function createModificationFile(array $modifications, $numMods = 2) { // TODO: // All array must be this class // NumMods must be uint $data = 'NumMods=' . $numMods . PHP_EOL; foreach ($modifications as $modification) { $entry = $modification->getMonoisotopicMass() . ','; $entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues()); $entry .= ','; $entry .= $modification->isFixed() ? 'fix,' : 'opt,'; $position = ''; switch ($modification->getPosition()) { case Modification::POSITION_PROTEIN_NTERM: $position = 'Prot-N-term'; break; case Modification::POSITION_PROTEIN_CTERM: $position = 'Prot-C-term'; break; case Modification::POSITION_NTERM: $position = 'N-term'; break; case Modification::POSITION_CTERM: $position = 'C-term'; break; case Modification::POSITION_ANY: default: $position = 'any'; break; } $entry .= $position . ','; $entry .= $modification->getName(); $data .= $entry . PHP_EOL; } $modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods'); file_put_contents($modFile, $data); return $modFile; }
[ "public", "static", "function", "createModificationFile", "(", "array", "$", "modifications", ",", "$", "numMods", "=", "2", ")", "{", "// TODO:", "// All array must be this class", "// NumMods must be uint", "$", "data", "=", "'NumMods='", ".", "$", "numMods", ".",...
Creates a modification file from an array of modifications @param Modification[] $modifications @param number $numMods Max number of modifications to search per peptide @return string File path the newly created modification file
[ "Creates", "a", "modification", "file", "from", "an", "array", "of", "modifications" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/Parameters/MsgfPlusSearchParameters.php#L455-L499
train
sylingd/Yesf
src/Config/Adapter/QConf.php
QConf.getKey
protected function getKey($key) { $key = '/' . $this->environment . '.' . $key; $key = str_replace('.', '/', $key); if (!empty($this->appName)) { $key = '/' . $this->appName . $key; } return $key; }
php
protected function getKey($key) { $key = '/' . $this->environment . '.' . $key; $key = str_replace('.', '/', $key); if (!empty($this->appName)) { $key = '/' . $this->appName . $key; } return $key; }
[ "protected", "function", "getKey", "(", "$", "key", ")", "{", "$", "key", "=", "'/'", ".", "$", "this", "->", "environment", ".", "'.'", ".", "$", "key", ";", "$", "key", "=", "str_replace", "(", "'.'", ",", "'/'", ",", "$", "key", ")", ";", "i...
Get real key @access protected @param string $key original key @return string
[ "Get", "real", "key" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/QConf.php#L33-L40
train
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/Result/Resultset.php
Resultset.append
public function append(array $row): void { if ($this->returnType === self::TYPE_ARRAYOBJECT) { $this->storage[] = new ArrayObject($row); } else { $this->storage[] = $row; } ++$this->count; }
php
public function append(array $row): void { if ($this->returnType === self::TYPE_ARRAYOBJECT) { $this->storage[] = new ArrayObject($row); } else { $this->storage[] = $row; } ++$this->count; }
[ "public", "function", "append", "(", "array", "$", "row", ")", ":", "void", "{", "if", "(", "$", "this", "->", "returnType", "===", "self", "::", "TYPE_ARRAYOBJECT", ")", "{", "$", "this", "->", "storage", "[", "]", "=", "new", "ArrayObject", "(", "$...
Append a row to the end of resultset. @param array $row an associative array
[ "Append", "a", "row", "to", "the", "end", "of", "resultset", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/Result/Resultset.php#L124-L132
train
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/Result/Resultset.php
Resultset.getArrayObject
public function getArrayObject(): ArrayObject { if ($this->returnType === self::TYPE_ARRAY) { return new ArrayObject($this->storage); } else { /** @var ArrayObject $storageAsArrayObject to silent static code analyzers */ $storageAsArrayObject = $this->storage; return $storageAsArrayObject; } }
php
public function getArrayObject(): ArrayObject { if ($this->returnType === self::TYPE_ARRAY) { return new ArrayObject($this->storage); } else { /** @var ArrayObject $storageAsArrayObject to silent static code analyzers */ $storageAsArrayObject = $this->storage; return $storageAsArrayObject; } }
[ "public", "function", "getArrayObject", "(", ")", ":", "ArrayObject", "{", "if", "(", "$", "this", "->", "returnType", "===", "self", "::", "TYPE_ARRAY", ")", "{", "return", "new", "ArrayObject", "(", "$", "this", "->", "storage", ")", ";", "}", "else", ...
Return underlying stored resultset as ArrayObject. Depending on the $returnType Resultset::TYPE_ARRAY|Resultset::TYPE_ARRAYOBJECT you can modify the internal storage @return ArrayObject
[ "Return", "underlying", "stored", "resultset", "as", "ArrayObject", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/Result/Resultset.php#L187-L197
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php
IpnNotificationParser.parseSnsMessage
public static function parseSnsMessage(Message $snsMsg) { // Create the message and extract the information we need $ipnMsg = new Message($snsMsg->getMandatoryField("Message")); self::_addMetadataToIpnMessage( $ipnMsg, $snsMsg->getNotificationMetadata() ); return $ipnMsg; }
php
public static function parseSnsMessage(Message $snsMsg) { // Create the message and extract the information we need $ipnMsg = new Message($snsMsg->getMandatoryField("Message")); self::_addMetadataToIpnMessage( $ipnMsg, $snsMsg->getNotificationMetadata() ); return $ipnMsg; }
[ "public", "static", "function", "parseSnsMessage", "(", "Message", "$", "snsMsg", ")", "{", "// Create the message and extract the information we need", "$", "ipnMsg", "=", "new", "Message", "(", "$", "snsMsg", "->", "getMandatoryField", "(", "\"Message\"", ")", ")", ...
Converts a an sns message into a ipn notification object @param Messsage $snsMsg snsMessage @throws OffAmazonPaymentsNotifications if there is an error @return Message ipn message
[ "Converts", "a", "an", "sns", "message", "into", "a", "ipn", "notification", "object" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php#L37-L46
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php
IpnNotificationParser._addMetadataToIpnMessage
private static function _addMetadataToIpnMessage ( Message $ipnMsg, OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata = null ) { $ipnMetadata = new OffAmazonPaymentsNotifications_Model_IPNNotificationMetadata( $ipnMsg, $messageMetadata ); $ipnMsg->setNotificationMetadata($ipnMetadata); }
php
private static function _addMetadataToIpnMessage ( Message $ipnMsg, OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata = null ) { $ipnMetadata = new OffAmazonPaymentsNotifications_Model_IPNNotificationMetadata( $ipnMsg, $messageMetadata ); $ipnMsg->setNotificationMetadata($ipnMetadata); }
[ "private", "static", "function", "_addMetadataToIpnMessage", "(", "Message", "$", "ipnMsg", ",", "OffAmazonPaymentsNotifications_NotificationMetadata", "$", "messageMetadata", "=", "null", ")", "{", "$", "ipnMetadata", "=", "new", "OffAmazonPaymentsNotifications_Model_IPNNoti...
Create the metadata object for the ipn message and attach to the object instance @param Message $ipnMsg ipn message @param OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata parent notification @return void
[ "Create", "the", "metadata", "object", "for", "the", "ipn", "message", "and", "attach", "to", "the", "object", "instance" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php#L57-L67
train
edmondscommerce/doctrine-static-meta
src/Builder/Builder.php
Builder.finaliseBuild
public function finaliseBuild(): self { $this->dataTransferObjectsForAllEntitiesAction->run(); $this->entityFormatter->run(); $this->copyPhpstormMeta->run(); return $this; }
php
public function finaliseBuild(): self { $this->dataTransferObjectsForAllEntitiesAction->run(); $this->entityFormatter->run(); $this->copyPhpstormMeta->run(); return $this; }
[ "public", "function", "finaliseBuild", "(", ")", ":", "self", "{", "$", "this", "->", "dataTransferObjectsForAllEntitiesAction", "->", "run", "(", ")", ";", "$", "this", "->", "entityFormatter", "->", "run", "(", ")", ";", "$", "this", "->", "copyPhpstormMet...
Finalise build - run various steps to wrap up the build and tidy up the codebase @return Builder
[ "Finalise", "build", "-", "run", "various", "steps", "to", "wrap", "up", "the", "build", "and", "tidy", "up", "the", "codebase" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Builder/Builder.php#L182-L189
train
Firesphere/silverstripe-bootstrapmfa
src/Extensions/MemberExtension.php
MemberExtension.onBeforeWrite
public function onBeforeWrite() { if (!$this->owner->MFAEnabled && SiteConfig::current_site_config()->ForceMFA) { $this->owner->MFAEnabled = true; $this->owner->updateMFA = true; } if (!$this->owner->BackupCodeSalt || $this->owner->updateMFA) { $algorithm = Security::config()->get('password_encryption_algorithm'); $encryptor = PasswordEncryptor::create_for_algorithm($algorithm); // No password. It's not even used in the salt generation $this->owner->BackupCodeSalt = $encryptor->salt(''); } }
php
public function onBeforeWrite() { if (!$this->owner->MFAEnabled && SiteConfig::current_site_config()->ForceMFA) { $this->owner->MFAEnabled = true; $this->owner->updateMFA = true; } if (!$this->owner->BackupCodeSalt || $this->owner->updateMFA) { $algorithm = Security::config()->get('password_encryption_algorithm'); $encryptor = PasswordEncryptor::create_for_algorithm($algorithm); // No password. It's not even used in the salt generation $this->owner->BackupCodeSalt = $encryptor->salt(''); } }
[ "public", "function", "onBeforeWrite", "(", ")", "{", "if", "(", "!", "$", "this", "->", "owner", "->", "MFAEnabled", "&&", "SiteConfig", "::", "current_site_config", "(", ")", "->", "ForceMFA", ")", "{", "$", "this", "->", "owner", "->", "MFAEnabled", "...
Force enable MFA on the member if needed
[ "Force", "enable", "MFA", "on", "the", "member", "if", "needed" ]
8d2d6c6f2f918c8fa157da91550b897816495a4b
https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Extensions/MemberExtension.php#L95-L109
train
Firesphere/silverstripe-bootstrapmfa
src/Extensions/MemberExtension.php
MemberExtension.isInGracePeriod
public function isInGracePeriod() { /** @var Member|MemberExtension $member */ $member = $this->owner; // If MFA is enabled on the member, we're always using it if ($member->MFAEnabled) { return false; } /** @var SiteConfig|SiteConfigExtension $config */ $config = SiteConfig::current_site_config(); // If MFA is not enforced, we're in an endless grace period if ($config->ForceMFA === null) { return true; } // Default the grace start day $graceStartDay = ($member->Created > $config->ForceMFA) ? $member->Created : $config->ForceMFA; $graceStartDay = new DateTime($graceStartDay); $gracePeriodInDays = Config::inst()->get(BootstrapMFAAuthenticator::class, 'grace_period'); $nowDate = new DateTime(DBDatetime::now()->Format(DBDatetime::ISO_DATE)); $daysSinceGraceStart = $nowDate->diff($graceStartDay)->days; return $daysSinceGraceStart < $gracePeriodInDays; }
php
public function isInGracePeriod() { /** @var Member|MemberExtension $member */ $member = $this->owner; // If MFA is enabled on the member, we're always using it if ($member->MFAEnabled) { return false; } /** @var SiteConfig|SiteConfigExtension $config */ $config = SiteConfig::current_site_config(); // If MFA is not enforced, we're in an endless grace period if ($config->ForceMFA === null) { return true; } // Default the grace start day $graceStartDay = ($member->Created > $config->ForceMFA) ? $member->Created : $config->ForceMFA; $graceStartDay = new DateTime($graceStartDay); $gracePeriodInDays = Config::inst()->get(BootstrapMFAAuthenticator::class, 'grace_period'); $nowDate = new DateTime(DBDatetime::now()->Format(DBDatetime::ISO_DATE)); $daysSinceGraceStart = $nowDate->diff($graceStartDay)->days; return $daysSinceGraceStart < $gracePeriodInDays; }
[ "public", "function", "isInGracePeriod", "(", ")", "{", "/** @var Member|MemberExtension $member */", "$", "member", "=", "$", "this", "->", "owner", ";", "// If MFA is enabled on the member, we're always using it", "if", "(", "$", "member", "->", "MFAEnabled", ")", "{"...
Check if a member is in grace period based on Created, date or enforcement @return bool @throws \Exception
[ "Check", "if", "a", "member", "is", "in", "grace", "period", "based", "on", "Created", "date", "or", "enforcement" ]
8d2d6c6f2f918c8fa157da91550b897816495a4b
https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Extensions/MemberExtension.php#L132-L160
train
PGB-LIV/php-ms
src/Core/AminoAcidMono.php
AminoAcidMono.getMonoisotopicMass
public static function getMonoisotopicMass($acid) { $value = @constant('pgb_liv\php_ms\Core\AminoAcidMono::' . $acid); if (! is_null($value)) { return $value; } if (strlen($acid) > 1) { throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid); } throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid); }
php
public static function getMonoisotopicMass($acid) { $value = @constant('pgb_liv\php_ms\Core\AminoAcidMono::' . $acid); if (! is_null($value)) { return $value; } if (strlen($acid) > 1) { throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid); } throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid); }
[ "public", "static", "function", "getMonoisotopicMass", "(", "$", "acid", ")", "{", "$", "value", "=", "@", "constant", "(", "'pgb_liv\\php_ms\\Core\\AminoAcidMono::'", ".", "$", "acid", ")", ";", "if", "(", "!", "is_null", "(", "$", "value", ")", ")", "{",...
Gets the monoisotopic mass for the provided amino acid. @param string $acid Amino acid @throws \InvalidArgumentException If acid is not a single character or valid amino acid @return float Monoisotopic mass
[ "Gets", "the", "monoisotopic", "mass", "for", "the", "provided", "amino", "acid", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/AminoAcidMono.php#L77-L90
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPalExpress.class.php
TShopPaymentHandlerPayPalExpress.GetUserDataFromPayPalData
protected function GetUserDataFromPayPalData(&$aBilling, &$aShipping) { $sCountryIsoCode = 'de'; if (array_key_exists('SHIPTOCOUNTRYCODE', $this->aCheckoutDetails)) { $sCountryIsoCode = $this->aCheckoutDetails['SHIPTOCOUNTRYCODE']; } $oShippingCountry = TdbDataCountry::GetInstanceForIsoCode($sCountryIsoCode); $sMail = (array_key_exists('EMAIL', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['EMAIL'] : ''; $sCompany = (array_key_exists('BUSINESS', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['BUSINESS'] : ''; //$sDataExtranetSalutationId = (array_key_exists('',$this->aCheckoutDetails)) ? $this->aCheckoutDetails[''] : ''; $sFirstname = (array_key_exists('FIRSTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['FIRSTNAME'] : ''; $sLastname = (array_key_exists('LASTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['LASTNAME'] : ''; $sStreet = (array_key_exists('SHIPTOSTREET', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET'] : ''; $sCity = (array_key_exists('SHIPTOCITY', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOCITY'] : ''; $sPostalcode = (array_key_exists('SHIPTOZIP', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOZIP'] : ''; $sTelefon = (array_key_exists('PHONENUM', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['PHONENUM'] : ''; $addressAdditionalInfo = (array_key_exists('SHIPTOSTREET2', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET2'] : ''; $aBilling = array('name' => $sMail, 'email' => $sMail, 'company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => $sFirstname, 'lastname' => $sLastname, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo); $sShippingLastName = (array_key_exists('SHIPTONAME', $this->aCheckoutDetails) && '' != $this->aCheckoutDetails['SHIPTONAME']) ? $this->aCheckoutDetails['SHIPTONAME'] : $sFirstname.' '.$sLastname; $aShipping = array('company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => '', 'lastname' => $sShippingLastName, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo); $this->postProcessBillingAndShippingAddress($aBilling, $aShipping); }
php
protected function GetUserDataFromPayPalData(&$aBilling, &$aShipping) { $sCountryIsoCode = 'de'; if (array_key_exists('SHIPTOCOUNTRYCODE', $this->aCheckoutDetails)) { $sCountryIsoCode = $this->aCheckoutDetails['SHIPTOCOUNTRYCODE']; } $oShippingCountry = TdbDataCountry::GetInstanceForIsoCode($sCountryIsoCode); $sMail = (array_key_exists('EMAIL', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['EMAIL'] : ''; $sCompany = (array_key_exists('BUSINESS', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['BUSINESS'] : ''; //$sDataExtranetSalutationId = (array_key_exists('',$this->aCheckoutDetails)) ? $this->aCheckoutDetails[''] : ''; $sFirstname = (array_key_exists('FIRSTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['FIRSTNAME'] : ''; $sLastname = (array_key_exists('LASTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['LASTNAME'] : ''; $sStreet = (array_key_exists('SHIPTOSTREET', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET'] : ''; $sCity = (array_key_exists('SHIPTOCITY', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOCITY'] : ''; $sPostalcode = (array_key_exists('SHIPTOZIP', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOZIP'] : ''; $sTelefon = (array_key_exists('PHONENUM', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['PHONENUM'] : ''; $addressAdditionalInfo = (array_key_exists('SHIPTOSTREET2', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET2'] : ''; $aBilling = array('name' => $sMail, 'email' => $sMail, 'company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => $sFirstname, 'lastname' => $sLastname, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo); $sShippingLastName = (array_key_exists('SHIPTONAME', $this->aCheckoutDetails) && '' != $this->aCheckoutDetails['SHIPTONAME']) ? $this->aCheckoutDetails['SHIPTONAME'] : $sFirstname.' '.$sLastname; $aShipping = array('company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => '', 'lastname' => $sShippingLastName, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo); $this->postProcessBillingAndShippingAddress($aBilling, $aShipping); }
[ "protected", "function", "GetUserDataFromPayPalData", "(", "&", "$", "aBilling", ",", "&", "$", "aShipping", ")", "{", "$", "sCountryIsoCode", "=", "'de'", ";", "if", "(", "array_key_exists", "(", "'SHIPTOCOUNTRYCODE'", ",", "$", "this", "->", "aCheckoutDetails"...
updates teh aBilling and aShipping arrays with the user billing and shipping info returned from paypal. @param array $aBilling @param array $aShipping
[ "updates", "teh", "aBilling", "and", "aShipping", "arrays", "with", "the", "user", "billing", "and", "shipping", "info", "returned", "from", "paypal", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPalExpress.class.php#L116-L144
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php
CLIExample.callStepAndCheckForException
protected function callStepAndCheckForException($stepName, $args = array()) { try { $response = call_user_func_array(array($this->exampleClass, $stepName), $args); } catch (OffAmazonPaymentsService_Exception $ex) { $this->printExceptionToCLI($ex, $stepName); throw $ex; } return $response; }
php
protected function callStepAndCheckForException($stepName, $args = array()) { try { $response = call_user_func_array(array($this->exampleClass, $stepName), $args); } catch (OffAmazonPaymentsService_Exception $ex) { $this->printExceptionToCLI($ex, $stepName); throw $ex; } return $response; }
[ "protected", "function", "callStepAndCheckForException", "(", "$", "stepName", ",", "$", "args", "=", "array", "(", ")", ")", "{", "try", "{", "$", "response", "=", "call_user_func_array", "(", "array", "(", "$", "this", "->", "exampleClass", ",", "$", "st...
Call the desired setp and check that it does not throw an exception @param string $stepName the name of the step to call on the example class @return mixed the response object from the step, or an exception if thrown
[ "Call", "the", "desired", "setp", "and", "check", "that", "it", "does", "not", "throw", "an", "exception" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php#L37-L47
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php
CLIExample.printExceptionToCLI
protected function printExceptionToCLI( OffAmazonPaymentsService_Exception $ex, $stepName ) { print "Error caught executing step " . $stepName . PHP_EOL; print "Caught Exception: " . $ex->getMessage() . PHP_EOL; print "Response Status Code: " . $ex->getStatusCode() . PHP_EOL; print "Error Code: " . $ex->getErrorCode() . PHP_EOL; print "Error Type: " . $ex->getErrorType() . PHP_EOL; print "Request ID: " . $ex->getRequestId() . PHP_EOL; print "XML: " . $ex->getXML() . PHP_EOL; print "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . PHP_EOL; }
php
protected function printExceptionToCLI( OffAmazonPaymentsService_Exception $ex, $stepName ) { print "Error caught executing step " . $stepName . PHP_EOL; print "Caught Exception: " . $ex->getMessage() . PHP_EOL; print "Response Status Code: " . $ex->getStatusCode() . PHP_EOL; print "Error Code: " . $ex->getErrorCode() . PHP_EOL; print "Error Type: " . $ex->getErrorType() . PHP_EOL; print "Request ID: " . $ex->getRequestId() . PHP_EOL; print "XML: " . $ex->getXML() . PHP_EOL; print "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . PHP_EOL; }
[ "protected", "function", "printExceptionToCLI", "(", "OffAmazonPaymentsService_Exception", "$", "ex", ",", "$", "stepName", ")", "{", "print", "\"Error caught executing step \"", ".", "$", "stepName", ".", "PHP_EOL", ";", "print", "\"Caught Exception: \"", ".", "$", "...
Output information about the raised exception to standard output @param OffAmazonPaymentsService_Exception $ex exception @param string $stepName step where ex occured @return no value
[ "Output", "information", "about", "the", "raised", "exception", "to", "standard", "output" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php#L57-L69
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariantDynamic.class.php
TPkgShopListfilterItemVariantDynamic.PostLoadHook
protected function PostLoadHook() { parent::PostLoadHook(); $oListFilterItemType = $this->GetFieldPkgShopListfilterItemType(); if ($oListFilterItemType) { $this->sVariantTypeIdentifier = $this->fieldVariantIdentifier; } }
php
protected function PostLoadHook() { parent::PostLoadHook(); $oListFilterItemType = $this->GetFieldPkgShopListfilterItemType(); if ($oListFilterItemType) { $this->sVariantTypeIdentifier = $this->fieldVariantIdentifier; } }
[ "protected", "function", "PostLoadHook", "(", ")", "{", "parent", "::", "PostLoadHook", "(", ")", ";", "$", "oListFilterItemType", "=", "$", "this", "->", "GetFieldPkgShopListfilterItemType", "(", ")", ";", "if", "(", "$", "oListFilterItemType", ")", "{", "$",...
Get variant system name and set it to sVariantTypeIdentifier.
[ "Get", "variant", "system", "name", "and", "set", "it", "to", "sVariantTypeIdentifier", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariantDynamic.class.php#L24-L31
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.ObserverRegister
public function ObserverRegister($sObserverName, &$oObserver) { if (!array_key_exists($sObserverName, $this->aObservers)) { $this->aObservers[$sObserverName] = &$oObserver; } }
php
public function ObserverRegister($sObserverName, &$oObserver) { if (!array_key_exists($sObserverName, $this->aObservers)) { $this->aObservers[$sObserverName] = &$oObserver; } }
[ "public", "function", "ObserverRegister", "(", "$", "sObserverName", ",", "&", "$", "oObserver", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "sObserverName", ",", "$", "this", "->", "aObservers", ")", ")", "{", "$", "this", "->", "aObservers", ...
register an observer with the user. @param string $sObserverName @param IDataExtranetUserObserver $oObserver
[ "register", "an", "observer", "with", "the", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L62-L67
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.Refresh
public function Refresh() { $iPt = $this->getItemPointer(); $this->GoToStart(); while ($oTmp = $this->Next()) { if (false === $oTmp->sqlData || ($oTmp->dAmount <= 0)) { $this->RemoveArticle($oTmp); } else { // refresh stock from db $oTmp->RefreshDataFromDatabase(); } } if ($iPt > $this->Length()) { $iPt = $this->Length(); } $this->setItemPointer($iPt); $this->UpdateListData(); }
php
public function Refresh() { $iPt = $this->getItemPointer(); $this->GoToStart(); while ($oTmp = $this->Next()) { if (false === $oTmp->sqlData || ($oTmp->dAmount <= 0)) { $this->RemoveArticle($oTmp); } else { // refresh stock from db $oTmp->RefreshDataFromDatabase(); } } if ($iPt > $this->Length()) { $iPt = $this->Length(); } $this->setItemPointer($iPt); $this->UpdateListData(); }
[ "public", "function", "Refresh", "(", ")", "{", "$", "iPt", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oTmp", "=", "$", "this", "->", "Next", "(", ")", ")", "{", "...
check list for dead articles.
[ "check", "list", "for", "dead", "articles", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L84-L101
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.&
public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType) { $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oShippingType->ArticleAffected($oItem)) { $oArticles->AddItem($oItem); } } if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) { // this shipping type should match ALL articles... so we now work with all articles $this->GoToStart(); $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ while ($oItem = &$this->Next()) { $oArticles->AddItem($oItem); } } // if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement if ($oShippingType->ArticleListValidForShippingType($oArticles)) { // we keep the list. we now need to mark all items in the list with that shipping type $oArticles->GoToStart(); while ($oItem = &$oArticles->Next()) { $this->SetShippingTypeForArticle($oItem, $oShippingType); } $oArticles->GoToStart(); } else { // does not match... so reset the list $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ } $this->setItemPointer($iPointer); return $oArticles; }
php
public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType) { $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oShippingType->ArticleAffected($oItem)) { $oArticles->AddItem($oItem); } } if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) { // this shipping type should match ALL articles... so we now work with all articles $this->GoToStart(); $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ while ($oItem = &$this->Next()) { $oArticles->AddItem($oItem); } } // if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement if ($oShippingType->ArticleListValidForShippingType($oArticles)) { // we keep the list. we now need to mark all items in the list with that shipping type $oArticles->GoToStart(); while ($oItem = &$oArticles->Next()) { $this->SetShippingTypeForArticle($oItem, $oShippingType); } $oArticles->GoToStart(); } else { // does not match... so reset the list $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ } $this->setItemPointer($iPointer); return $oArticles; }
[ "public", "function", "&", "GetArticlesAffectedByShippingType", "(", "TdbShopShippingType", "&", "$", "oShippingType", ")", "{", "$", "oArticles", "=", "new", "TShopBasketArticleList", "(", ")", ";", "/** @var $oArticles TShopBasketArticleList */", "$", "iPointer", "=", ...
returns array with pointers to all basket articles that match the shipping type. @param TdbShopShippingType $oShippingType @return TShopBasketArticleList
[ "returns", "array", "with", "pointers", "to", "all", "basket", "articles", "that", "match", "the", "shipping", "type", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L110-L147
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.&
public function &GetListMatchingVat(TdbShopVat &$oVat) { $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItemVat = $oItem->GetVat(); if (!is_null($oItemVat) && $oItemVat->id == $oVat->id) { $oArticles->AddItem($oItem); } } $this->setItemPointer($iPointer); return $oArticles; }
php
public function &GetListMatchingVat(TdbShopVat &$oVat) { $oArticles = new TShopBasketArticleList(); /** @var $oArticles TShopBasketArticleList */ $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItemVat = $oItem->GetVat(); if (!is_null($oItemVat) && $oItemVat->id == $oVat->id) { $oArticles->AddItem($oItem); } } $this->setItemPointer($iPointer); return $oArticles; }
[ "public", "function", "&", "GetListMatchingVat", "(", "TdbShopVat", "&", "$", "oVat", ")", "{", "$", "oArticles", "=", "new", "TShopBasketArticleList", "(", ")", ";", "/** @var $oArticles TShopBasketArticleList */", "$", "iPointer", "=", "$", "this", "->", "getIte...
return list matchin the vat group. @param TdbShopVat $oVat @return TShopBasketArticleList
[ "return", "list", "matchin", "the", "vat", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L156-L172
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.SetShippingTypeForArticle
protected function SetShippingTypeForArticle(TShopBasketArticle &$oItem, TdbShopShippingType &$oShippingType) { $iCurrentPos = $this->getItemPointer(); $this->GoToStart(); $bFound = false; while (!$bFound && ($oExistingItem = &$this->Next())) { /** @var $oExistingItem TShopBasketArticle */ if ($oExistingItem->IsSameAs($oItem)) { $bFound = true; } } if ($bFound) { $oExistingItem->SetActingShippingType($oShippingType); } $this->setItemPointer($iCurrentPos); }
php
protected function SetShippingTypeForArticle(TShopBasketArticle &$oItem, TdbShopShippingType &$oShippingType) { $iCurrentPos = $this->getItemPointer(); $this->GoToStart(); $bFound = false; while (!$bFound && ($oExistingItem = &$this->Next())) { /** @var $oExistingItem TShopBasketArticle */ if ($oExistingItem->IsSameAs($oItem)) { $bFound = true; } } if ($bFound) { $oExistingItem->SetActingShippingType($oShippingType); } $this->setItemPointer($iCurrentPos); }
[ "protected", "function", "SetShippingTypeForArticle", "(", "TShopBasketArticle", "&", "$", "oItem", ",", "TdbShopShippingType", "&", "$", "oShippingType", ")", "{", "$", "iCurrentPos", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", ...
marks the item in the list with the shipping type. @param TShopBasketArticle $oItem @param TdbShopShippingType $oShippingType
[ "marks", "the", "item", "in", "the", "list", "with", "the", "shipping", "type", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L180-L195
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.UpdateListData
protected function UpdateListData() { $this->dNumberOfItems = 0; $this->dProductPrice = 0; $this->dTotalWeight = 0; $this->dTotalVolume = 0; $tmpPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->dAmount <= 0) { $this->RemoveArticle($oItem); } else { $this->dNumberOfItems += $oItem->dAmount; $this->dProductPrice += $oItem->dPriceTotal; $this->dTotalWeight += $oItem->dTotalWeight; $this->dTotalVolume += $oItem->dTotalVolume; } } $this->setItemPointer($tmpPointer); }
php
protected function UpdateListData() { $this->dNumberOfItems = 0; $this->dProductPrice = 0; $this->dTotalWeight = 0; $this->dTotalVolume = 0; $tmpPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->dAmount <= 0) { $this->RemoveArticle($oItem); } else { $this->dNumberOfItems += $oItem->dAmount; $this->dProductPrice += $oItem->dPriceTotal; $this->dTotalWeight += $oItem->dTotalWeight; $this->dTotalVolume += $oItem->dTotalVolume; } } $this->setItemPointer($tmpPointer); }
[ "protected", "function", "UpdateListData", "(", ")", "{", "$", "this", "->", "dNumberOfItems", "=", "0", ";", "$", "this", "->", "dProductPrice", "=", "0", ";", "$", "this", "->", "dTotalWeight", "=", "0", ";", "$", "this", "->", "dTotalVolume", "=", "...
used to update class data wenn the class state changes.
[ "used", "to", "update", "class", "data", "wenn", "the", "class", "state", "changes", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L318-L339
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.GetBasketQuantityForVoucher
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher) { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $iAmount = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem); if ($bIncludeProduct) { $iAmount = $iAmount + $oItem->dAmount; } } $this->setItemPointer($iCurrentPosition); return $iAmount; }
php
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher) { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $iAmount = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem); if ($bIncludeProduct) { $iAmount = $iAmount + $oItem->dAmount; } } $this->setItemPointer($iCurrentPosition); return $iAmount; }
[ "public", "function", "GetBasketQuantityForVoucher", "(", "TdbShopVoucher", "&", "$", "oVoucher", ")", "{", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "$", "iAmount", "=", ...
returns the total number of items affected by a voucher. @param TdbShopVoucher $oVoucher @return float
[ "returns", "the", "total", "number", "of", "items", "affected", "by", "a", "voucher", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L525-L539
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.GetBasketSumForDiscount
public function GetBasketSumForDiscount(TdbShopDiscount &$oDiscount) { // get the sum of all products (we exclude products with "fieldExcludeFromDiscounts") $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dProductValue = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem); if ($bIncludeProduct) { $dProductValue = $dProductValue + $oItem->dPriceTotal; } } $this->setItemPointer($iCurrentPosition); return $dProductValue; }
php
public function GetBasketSumForDiscount(TdbShopDiscount &$oDiscount) { // get the sum of all products (we exclude products with "fieldExcludeFromDiscounts") $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dProductValue = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem); if ($bIncludeProduct) { $dProductValue = $dProductValue + $oItem->dPriceTotal; } } $this->setItemPointer($iCurrentPosition); return $dProductValue; }
[ "public", "function", "GetBasketSumForDiscount", "(", "TdbShopDiscount", "&", "$", "oDiscount", ")", "{", "// get the sum of all products (we exclude products with \"fieldExcludeFromDiscounts\")", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";...
returns the total basket value for alle articles that may be used for the discount passed. the method takes active discounts into account. @param TdbShopDiscount $oDiscount @return float
[ "returns", "the", "total", "basket", "value", "for", "alle", "articles", "that", "may", "be", "used", "for", "the", "discount", "passed", ".", "the", "method", "takes", "active", "discounts", "into", "account", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L549-L564
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.GetBasketQuantityForDiscount
public function GetBasketQuantityForDiscount(TdbShopDiscount &$oDiscount) { // get the sum of all products (we exclude products with "fieldExcludeFromDiscounts") $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $iAmount = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem); if ($bIncludeProduct) { $iAmount = $iAmount + $oItem->dAmount; } } $this->setItemPointer($iCurrentPosition); return $iAmount; }
php
public function GetBasketQuantityForDiscount(TdbShopDiscount &$oDiscount) { // get the sum of all products (we exclude products with "fieldExcludeFromDiscounts") $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $iAmount = 0; while ($oItem = &$this->Next()) { $bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem); if ($bIncludeProduct) { $iAmount = $iAmount + $oItem->dAmount; } } $this->setItemPointer($iCurrentPosition); return $iAmount; }
[ "public", "function", "GetBasketQuantityForDiscount", "(", "TdbShopDiscount", "&", "$", "oDiscount", ")", "{", "// get the sum of all products (we exclude products with \"fieldExcludeFromDiscounts\")", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")",...
returns the total number of items affected by a discount. @param TdbShopDiscount $oDiscount @return float
[ "returns", "the", "total", "number", "of", "items", "affected", "by", "a", "discount", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L573-L588
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.ApplyDiscount
public function ApplyDiscount(TdbShopDiscount $oDiscount) { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dTotalDiscountValue = 0; $bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType); if ($bIsAbsoluteDiscount) { $dTotalDiscountValue = $oDiscount->fieldValue; } $totalDiscountValueItemCalculated = 0; while ($oItem = &$this->Next()) { if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) { $oDiscountToPass = clone $oDiscount; $oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue); $totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed; } } $totalDiscountValueOverAll = $oDiscount->GetValue(); if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) { $missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated; $this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue); } $this->setItemPointer($iCurrentPosition); }
php
public function ApplyDiscount(TdbShopDiscount $oDiscount) { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dTotalDiscountValue = 0; $bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType); if ($bIsAbsoluteDiscount) { $dTotalDiscountValue = $oDiscount->fieldValue; } $totalDiscountValueItemCalculated = 0; while ($oItem = &$this->Next()) { if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) { $oDiscountToPass = clone $oDiscount; $oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue); $totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed; } } $totalDiscountValueOverAll = $oDiscount->GetValue(); if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) { $missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated; $this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue); } $this->setItemPointer($iCurrentPosition); }
[ "public", "function", "ApplyDiscount", "(", "TdbShopDiscount", "$", "oDiscount", ")", "{", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "$", "dTotalDiscountValue", "=", "0", ...
apply a discount to the basket item list. @param TdbShopDiscount $oDiscount
[ "apply", "a", "discount", "to", "the", "basket", "item", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L634-L659
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.GetTotalDiscountValue
public function GetTotalDiscountValue() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dTotalDiscountValue = 0; while ($oItem = &$this->Next()) { $dTotalDiscountValue += ($oItem->dPriceTotal - $oItem->dPriceTotalAfterDiscount); } $this->setItemPointer($iCurrentPosition); return $dTotalDiscountValue; }
php
public function GetTotalDiscountValue() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); $dTotalDiscountValue = 0; while ($oItem = &$this->Next()) { $dTotalDiscountValue += ($oItem->dPriceTotal - $oItem->dPriceTotalAfterDiscount); } $this->setItemPointer($iCurrentPosition); return $dTotalDiscountValue; }
[ "public", "function", "GetTotalDiscountValue", "(", ")", "{", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "$", "dTotalDiscountValue", "=", "0", ";", "while", "(", "$", "...
return the total discount value for alle articles. @return float
[ "return", "the", "total", "discount", "value", "for", "alle", "articles", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L666-L679
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.ResetAllDiscounts
public function ResetAllDiscounts() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItem->ResetDiscounts(); } $this->setItemPointer($iCurrentPosition); }
php
public function ResetAllDiscounts() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItem->ResetDiscounts(); } $this->setItemPointer($iCurrentPosition); }
[ "public", "function", "ResetAllDiscounts", "(", ")", "{", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$", "this", "->", "Next", ...
resets all discount info for alle articles.
[ "resets", "all", "discount", "info", "for", "alle", "articles", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L684-L693
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.ResetAllShippingMarkers
public function ResetAllShippingMarkers() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItem->ResetShippingMarker(); } $this->setItemPointer($iCurrentPosition); }
php
public function ResetAllShippingMarkers() { $iCurrentPosition = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $oItem->ResetShippingMarker(); } $this->setItemPointer($iCurrentPosition); }
[ "public", "function", "ResetAllShippingMarkers", "(", ")", "{", "$", "iCurrentPosition", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$", "this", "->", "N...
drop the acting shipping type marker from all articles in the basket. this is needed when we want to recalculate shipping costs.
[ "drop", "the", "acting", "shipping", "type", "marker", "from", "all", "articles", "in", "the", "basket", ".", "this", "is", "needed", "when", "we", "want", "to", "recalculate", "shipping", "costs", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L699-L708
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.validateBasketContentBuyable
private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager) { $bValid = true; if (false === $oBasketArticle->IsBuyable()) { $oMessage = TCMSMessageManager::GetInstance(); $aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix(); $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes); if ($this->IsInList($oBasketArticle)) { $this->RemoveArticle($oBasketArticle); } $bValid = false; } return $bValid; }
php
private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager) { $bValid = true; if (false === $oBasketArticle->IsBuyable()) { $oMessage = TCMSMessageManager::GetInstance(); $aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix(); $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes); if ($this->IsInList($oBasketArticle)) { $this->RemoveArticle($oBasketArticle); } $bValid = false; } return $bValid; }
[ "private", "function", "validateBasketContentBuyable", "(", "TShopBasketArticle", "$", "oBasketArticle", ",", "$", "sMessageManager", ")", "{", "$", "bValid", "=", "true", ";", "if", "(", "false", "===", "$", "oBasketArticle", "->", "IsBuyable", "(", ")", ")", ...
Checks if given basket article is buyable. If not remove it from basket with message. @param TShopBasketArticle $oBasketArticle @param string $sMessageManager @return bool
[ "Checks", "if", "given", "basket", "article", "is", "buyable", ".", "If", "not", "remove", "it", "from", "basket", "with", "message", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L755-L769
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.PostUpdateItemHook
protected function PostUpdateItemHook($oUpdatedItem) { reset($this->aObservers); foreach (array_keys($this->aObservers) as $sObserverName) { $this->aObservers[$sObserverName]->OnBasketItemUpdateEvent($oUpdatedItem); } }
php
protected function PostUpdateItemHook($oUpdatedItem) { reset($this->aObservers); foreach (array_keys($this->aObservers) as $sObserverName) { $this->aObservers[$sObserverName]->OnBasketItemUpdateEvent($oUpdatedItem); } }
[ "protected", "function", "PostUpdateItemHook", "(", "$", "oUpdatedItem", ")", "{", "reset", "(", "$", "this", "->", "aObservers", ")", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "aObservers", ")", "as", "$", "sObserverName", ")", "{", "$", ...
called whenever an item in the basket item list is changed. @param TShopBasketArticle $oUpdatedItem
[ "called", "whenever", "an", "item", "in", "the", "basket", "item", "list", "is", "changed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L776-L782
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
TShopBasketArticleCoreList.PostDeleteItemHook
protected function PostDeleteItemHook($oDeletedItem) { reset($this->aObservers); foreach (array_keys($this->aObservers) as $sObserverName) { $this->aObservers[$sObserverName]->OnBasketItemDeleteEvent($oDeletedItem); } }
php
protected function PostDeleteItemHook($oDeletedItem) { reset($this->aObservers); foreach (array_keys($this->aObservers) as $sObserverName) { $this->aObservers[$sObserverName]->OnBasketItemDeleteEvent($oDeletedItem); } }
[ "protected", "function", "PostDeleteItemHook", "(", "$", "oDeletedItem", ")", "{", "reset", "(", "$", "this", "->", "aObservers", ")", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "aObservers", ")", "as", "$", "sObserverName", ")", "{", "$", ...
called whenever an item is removed from the item list. @param TShopBasketArticle $oDeletedItem
[ "called", "whenever", "an", "item", "is", "removed", "from", "the", "item", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L789-L795
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.confirmTransactionById
public function confirmTransactionById($transactionId, $iConfirmedDate) { $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance(); if (false === $oTransaction->Load($transactionId)) { return null; } return $this->confirmTransactionObject($oTransaction, $iConfirmedDate); }
php
public function confirmTransactionById($transactionId, $iConfirmedDate) { $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance(); if (false === $oTransaction->Load($transactionId)) { return null; } return $this->confirmTransactionObject($oTransaction, $iConfirmedDate); }
[ "public", "function", "confirmTransactionById", "(", "$", "transactionId", ",", "$", "iConfirmedDate", ")", "{", "$", "oTransaction", "=", "TdbPkgShopPaymentTransaction", "::", "GetNewInstance", "(", ")", ";", "if", "(", "false", "===", "$", "oTransaction", "->", ...
searches for a transaction with matching id number and confirms it. returns the transaction if found, null if not. @param $transactionId @param $iConfirmedDate @return TdbPkgShopPaymentTransaction
[ "searches", "for", "a", "transaction", "with", "matching", "id", "number", "and", "confirms", "it", ".", "returns", "the", "transaction", "if", "found", "null", "if", "not", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L123-L131
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.confirmTransaction
public function confirmTransaction($iSequenceNumber, $iConfirmedDate) { $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance(); $loadData = array('shop_order_id' => $this->order->id, 'sequence_number' => $iSequenceNumber); if (true === $oTransaction->LoadFromFields($loadData)) { $oTransaction = $this->confirmTransactionObject($oTransaction, $iConfirmedDate); } else { $oTransaction = null; } return $oTransaction; }
php
public function confirmTransaction($iSequenceNumber, $iConfirmedDate) { $oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance(); $loadData = array('shop_order_id' => $this->order->id, 'sequence_number' => $iSequenceNumber); if (true === $oTransaction->LoadFromFields($loadData)) { $oTransaction = $this->confirmTransactionObject($oTransaction, $iConfirmedDate); } else { $oTransaction = null; } return $oTransaction; }
[ "public", "function", "confirmTransaction", "(", "$", "iSequenceNumber", ",", "$", "iConfirmedDate", ")", "{", "$", "oTransaction", "=", "TdbPkgShopPaymentTransaction", "::", "GetNewInstance", "(", ")", ";", "$", "loadData", "=", "array", "(", "'shop_order_id'", "...
searches for a transaction with matching sequence number and confirms it. returns the transaction if found, null if not. @param int $iSequenceNumber @param int $iConfirmedDate - unix timestamp @return \TdbPkgShopPaymentTransaction|null
[ "searches", "for", "a", "transaction", "with", "matching", "sequence", "number", "and", "confirms", "it", ".", "returns", "the", "transaction", "if", "found", "null", "if", "not", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L141-L152
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.confirmTransactionObject
public function confirmTransactionObject(TdbPkgShopPaymentTransaction $transaction, $iConfirmedDate) { if (false === $transaction->fieldConfirmed) { $transaction->AllowEditByAll(true); $transaction->SaveFieldsFast( array('confirmed' => '1', 'confirmed_date' => date('Y-m-d H:i:s', $iConfirmedDate)) ); $transaction->AllowEditByAll(false); // mark order as paid/unpaid depending on the remaining balance $this->updateOrderPaidStatusBasedOnCurrentBalance(); $this->updateRealUsedVoucherValueBasedOnTransactions($transaction); } return $transaction; }
php
public function confirmTransactionObject(TdbPkgShopPaymentTransaction $transaction, $iConfirmedDate) { if (false === $transaction->fieldConfirmed) { $transaction->AllowEditByAll(true); $transaction->SaveFieldsFast( array('confirmed' => '1', 'confirmed_date' => date('Y-m-d H:i:s', $iConfirmedDate)) ); $transaction->AllowEditByAll(false); // mark order as paid/unpaid depending on the remaining balance $this->updateOrderPaidStatusBasedOnCurrentBalance(); $this->updateRealUsedVoucherValueBasedOnTransactions($transaction); } return $transaction; }
[ "public", "function", "confirmTransactionObject", "(", "TdbPkgShopPaymentTransaction", "$", "transaction", ",", "$", "iConfirmedDate", ")", "{", "if", "(", "false", "===", "$", "transaction", "->", "fieldConfirmed", ")", "{", "$", "transaction", "->", "AllowEditByAl...
confirm given transaction object. @param TdbPkgShopPaymentTransaction $transaction @param $iConfirmedDate @return TdbPkgShopPaymentTransaction
[ "confirm", "given", "transaction", "object", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L162-L176
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.getNextTransactionSequenceNumber
protected function getNextTransactionSequenceNumber() { $query = "SELECT MAX(sequence_number) AS max_sequence_number FROM `pkg_shop_payment_transaction` WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '".MySqlLegacySupport::getInstance( )->real_escape_string( $this->order->id )."' GROUP BY `pkg_shop_payment_transaction`.`shop_order_id` "; if ($aSum = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $iSequenceNumber = $aSum['max_sequence_number'] + 1; } else { $iSequenceNumber = 1; } return $iSequenceNumber; }
php
protected function getNextTransactionSequenceNumber() { $query = "SELECT MAX(sequence_number) AS max_sequence_number FROM `pkg_shop_payment_transaction` WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '".MySqlLegacySupport::getInstance( )->real_escape_string( $this->order->id )."' GROUP BY `pkg_shop_payment_transaction`.`shop_order_id` "; if ($aSum = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $iSequenceNumber = $aSum['max_sequence_number'] + 1; } else { $iSequenceNumber = 1; } return $iSequenceNumber; }
[ "protected", "function", "getNextTransactionSequenceNumber", "(", ")", "{", "$", "query", "=", "\"SELECT MAX(sequence_number) AS max_sequence_number\n FROM `pkg_shop_payment_transaction`\n WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '\"", ".", "M...
returns the transaction sequence for the next transaction. @return int
[ "returns", "the", "transaction", "sequence", "for", "the", "next", "transaction", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L332-L349
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.getBillableProducts
public function getBillableProducts($bIncludeUnconfirmedTransactions = true) { $aProductList = array(); $oOrderItemList = $this->order->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $iBilled = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT, $bIncludeUnconfirmedTransactions ); $iRemaining = round($oOrderItem->fieldOrderAmount - $iBilled); if ($iRemaining > 0) { $aProductList[$oOrderItem->id] = $iRemaining; } } $oOrderItemList->GoToStart(); return $aProductList; }
php
public function getBillableProducts($bIncludeUnconfirmedTransactions = true) { $aProductList = array(); $oOrderItemList = $this->order->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $iBilled = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT, $bIncludeUnconfirmedTransactions ); $iRemaining = round($oOrderItem->fieldOrderAmount - $iBilled); if ($iRemaining > 0) { $aProductList[$oOrderItem->id] = $iRemaining; } } $oOrderItemList->GoToStart(); return $aProductList; }
[ "public", "function", "getBillableProducts", "(", "$", "bIncludeUnconfirmedTransactions", "=", "true", ")", "{", "$", "aProductList", "=", "array", "(", ")", ";", "$", "oOrderItemList", "=", "$", "this", "->", "order", "->", "GetFieldShopOrderItemList", "(", ")"...
returns an array with all products that have not been billed via a transaction. @param $bIncludeUnconfirmedTransactions @return array [shop_order_item_id] = amount
[ "returns", "an", "array", "with", "all", "products", "that", "have", "not", "been", "billed", "via", "a", "transaction", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L415-L434
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.getRefundableProducts
public function getRefundableProducts($bIncludeUnconfirmedTransactions = true) { $aProductList = array(); $oOrderItemList = $this->order->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $iBilled = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT, false ); $iRefunded = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_CREDIT, $bIncludeUnconfirmedTransactions ); $iRefunded += $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT_REVERSAL, $bIncludeUnconfirmedTransactions ); $iRefundable = round($iBilled + $iRefunded); if ($iRefundable > 0) { $aProductList[$oOrderItem->id] = $iRefundable; } } $oOrderItemList->GoToStart(); return $aProductList; }
php
public function getRefundableProducts($bIncludeUnconfirmedTransactions = true) { $aProductList = array(); $oOrderItemList = $this->order->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $iBilled = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT, false ); $iRefunded = $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_CREDIT, $bIncludeUnconfirmedTransactions ); $iRefunded += $this->getProductAmountWithTransactionType( $oOrderItem->id, self::TRANSACTION_TYPE_PAYMENT_REVERSAL, $bIncludeUnconfirmedTransactions ); $iRefundable = round($iBilled + $iRefunded); if ($iRefundable > 0) { $aProductList[$oOrderItem->id] = $iRefundable; } } $oOrderItemList->GoToStart(); return $aProductList; }
[ "public", "function", "getRefundableProducts", "(", "$", "bIncludeUnconfirmedTransactions", "=", "true", ")", "{", "$", "aProductList", "=", "array", "(", ")", ";", "$", "oOrderItemList", "=", "$", "this", "->", "order", "->", "GetFieldShopOrderItemList", "(", "...
returns an array of all products that have been billed and not refunded. @param $bIncludeUnconfirmedTransactions @return array [shop_order_item_id] = amount
[ "returns", "an", "array", "of", "all", "products", "that", "have", "been", "billed", "and", "not", "refunded", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L443-L472
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php
TPkgShopPaymentTransactionManagerEndPoint.allProductsAreRefundable
public function allProductsAreRefundable() { $bProductsHaveBeenRefunded = $this->hasTransactions(self::TRANSACTION_TYPE_PAYMENT_REVERSAL) || $this->hasTransactions(self::TRANSACTION_TYPE_CREDIT); if (true === $bProductsHaveBeenRefunded) { return false; } if ($this->order->fieldValueTotal == $this->getMaxAllowedValueFor(self::TRANSACTION_TYPE_CREDIT)) { return true; } return false; }
php
public function allProductsAreRefundable() { $bProductsHaveBeenRefunded = $this->hasTransactions(self::TRANSACTION_TYPE_PAYMENT_REVERSAL) || $this->hasTransactions(self::TRANSACTION_TYPE_CREDIT); if (true === $bProductsHaveBeenRefunded) { return false; } if ($this->order->fieldValueTotal == $this->getMaxAllowedValueFor(self::TRANSACTION_TYPE_CREDIT)) { return true; } return false; }
[ "public", "function", "allProductsAreRefundable", "(", ")", "{", "$", "bProductsHaveBeenRefunded", "=", "$", "this", "->", "hasTransactions", "(", "self", "::", "TRANSACTION_TYPE_PAYMENT_REVERSAL", ")", "||", "$", "this", "->", "hasTransactions", "(", "self", "::", ...
returns true if all products are refundable. That is the case if. a) no product has been refunded b) ALL products have been paid
[ "returns", "true", "if", "all", "products", "are", "refundable", ".", "That", "is", "the", "case", "if", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L480-L493
train
edmondscommerce/doctrine-static-meta
src/Entity/Debug/DebugEntityDataObjectIds.php
DebugEntityDataObjectIds.initDebugIds
private function initDebugIds(bool $created = false) { $this->debugIdAsString = (string)$this->id; $this->debugObjectHash = spl_object_hash($this); if (false === $created) { return; } static $increment = 0; $this->debugCreationIncrement = ++$increment; }
php
private function initDebugIds(bool $created = false) { $this->debugIdAsString = (string)$this->id; $this->debugObjectHash = spl_object_hash($this); if (false === $created) { return; } static $increment = 0; $this->debugCreationIncrement = ++$increment; }
[ "private", "function", "initDebugIds", "(", "bool", "$", "created", "=", "false", ")", "{", "$", "this", "->", "debugIdAsString", "=", "(", "string", ")", "$", "this", "->", "id", ";", "$", "this", "->", "debugObjectHash", "=", "spl_object_hash", "(", "$...
When creating a new Entity, we track the increment to help with identifying Entities @param bool $created @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "When", "creating", "a", "new", "Entity", "we", "track", "the", "increment", "to", "help", "with", "identifying", "Entities" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Debug/DebugEntityDataObjectIds.php#L36-L45
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php
TCMSShopTableEditor_ShopVoucherSeries.CreateVoucherCodes
public function CreateVoucherCodes($sCode = null, $iNumberOfVouchers = null) { $oReturn = new stdClass(); $oReturn->bError = false; $oReturn->sMessage = 'Gutscheine erstellt'; if ($this->AllowCreatingVoucherCodes()) { $oGlobal = TGlobal::instance(); if (is_null($iNumberOfVouchers)) { $iNumberOfVouchers = intval($oGlobal->GetUserData('iNumberOfVouchers')); } if (is_null($sCode)) { $sCode = $oGlobal->GetUserData('sCode'); } $bUseRandomCode = (empty($sCode)); if (!$bUseRandomCode) { // make sure that the code does not exist in another series $query = "SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id` <> '".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."' AND `code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sCode)."'"; $tRes = MySqlLegacySupport::getInstance()->query($query); if (MySqlLegacySupport::getInstance()->num_rows($tRes) > 0) { // invalid code $oReturn->bError = true; $oReturn->sMessage = 'Code wurde bereits in mindestens einer anderen Gutscheinserie verwendet!'; } } if (!$oReturn->bError) { $oVoucher = TdbShopVoucher::GetNewInstance(); /** @var $oVoucher TdbShopVoucher */ $oVoucherCodeTableConf = &$oVoucher->GetTableConf(); $oVoucherCodeEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oVoucherCodeEditor->Init($oVoucherCodeTableConf->id, null); $oVoucher->AllowEditByAll(true); TCacheManager::SetDisableCaching(true); for ($i = 0; $i < $iNumberOfVouchers; ++$i) { if ($bUseRandomCode) { do { $sCode = strtolower(TTools::GenerateVoucherCode(10)); if ($oVoucher->LoadFromFields(array('code' => $sCode))) { $sCode = ''; } } while (empty($sCode)); } $aData = array('shop_voucher_series_id' => $this->sId, 'code' => $sCode, 'datecreated' => date('Y-m-d H:i:s')); // save entrie... $oVoucherCodeEditor->Save($aData); } TCacheManager::SetDisableCaching(false); TCacheManager::PerformeTableChange('shop_voucher', null); // flush all cache entries related to the voucher table } } return $oReturn; }
php
public function CreateVoucherCodes($sCode = null, $iNumberOfVouchers = null) { $oReturn = new stdClass(); $oReturn->bError = false; $oReturn->sMessage = 'Gutscheine erstellt'; if ($this->AllowCreatingVoucherCodes()) { $oGlobal = TGlobal::instance(); if (is_null($iNumberOfVouchers)) { $iNumberOfVouchers = intval($oGlobal->GetUserData('iNumberOfVouchers')); } if (is_null($sCode)) { $sCode = $oGlobal->GetUserData('sCode'); } $bUseRandomCode = (empty($sCode)); if (!$bUseRandomCode) { // make sure that the code does not exist in another series $query = "SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id` <> '".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."' AND `code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sCode)."'"; $tRes = MySqlLegacySupport::getInstance()->query($query); if (MySqlLegacySupport::getInstance()->num_rows($tRes) > 0) { // invalid code $oReturn->bError = true; $oReturn->sMessage = 'Code wurde bereits in mindestens einer anderen Gutscheinserie verwendet!'; } } if (!$oReturn->bError) { $oVoucher = TdbShopVoucher::GetNewInstance(); /** @var $oVoucher TdbShopVoucher */ $oVoucherCodeTableConf = &$oVoucher->GetTableConf(); $oVoucherCodeEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oVoucherCodeEditor->Init($oVoucherCodeTableConf->id, null); $oVoucher->AllowEditByAll(true); TCacheManager::SetDisableCaching(true); for ($i = 0; $i < $iNumberOfVouchers; ++$i) { if ($bUseRandomCode) { do { $sCode = strtolower(TTools::GenerateVoucherCode(10)); if ($oVoucher->LoadFromFields(array('code' => $sCode))) { $sCode = ''; } } while (empty($sCode)); } $aData = array('shop_voucher_series_id' => $this->sId, 'code' => $sCode, 'datecreated' => date('Y-m-d H:i:s')); // save entrie... $oVoucherCodeEditor->Save($aData); } TCacheManager::SetDisableCaching(false); TCacheManager::PerformeTableChange('shop_voucher', null); // flush all cache entries related to the voucher table } } return $oReturn; }
[ "public", "function", "CreateVoucherCodes", "(", "$", "sCode", "=", "null", ",", "$", "iNumberOfVouchers", "=", "null", ")", "{", "$", "oReturn", "=", "new", "stdClass", "(", ")", ";", "$", "oReturn", "->", "bError", "=", "false", ";", "$", "oReturn", ...
create a number of vouchers in the shop_voucher table. @param string $sCode - the code to use. if empty, a random unique code will be generated @param int $iNumberOfVouchers - number of vouchers to create (will fetch this from user input if null given)
[ "create", "a", "number", "of", "vouchers", "in", "the", "shop_voucher", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L70-L127
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php
TCMSShopTableEditor_ShopVoucherSeries.AllowCreatingVoucherCodes
protected function AllowCreatingVoucherCodes() { $bAllowCreatingCodes = false; $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ if ($oTargetTableConf->Loadfromfield('name', 'shop_voucher')) { $oGlobal = TGlobal::instance(); $bUserIsInCodeTableGroup = $oGlobal->oUser->oAccessManager->user->IsInGroups($oTargetTableConf->fieldCmsUsergroupId); $bHasNewPermissionOnTargetTable = ($oGlobal->oUser->oAccessManager->HasNewPermission('shop_voucher')); $bAllowCreatingCodes = ($bUserIsInCodeTableGroup && $bHasNewPermissionOnTargetTable); } return $bAllowCreatingCodes; }
php
protected function AllowCreatingVoucherCodes() { $bAllowCreatingCodes = false; $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ if ($oTargetTableConf->Loadfromfield('name', 'shop_voucher')) { $oGlobal = TGlobal::instance(); $bUserIsInCodeTableGroup = $oGlobal->oUser->oAccessManager->user->IsInGroups($oTargetTableConf->fieldCmsUsergroupId); $bHasNewPermissionOnTargetTable = ($oGlobal->oUser->oAccessManager->HasNewPermission('shop_voucher')); $bAllowCreatingCodes = ($bUserIsInCodeTableGroup && $bHasNewPermissionOnTargetTable); } return $bAllowCreatingCodes; }
[ "protected", "function", "AllowCreatingVoucherCodes", "(", ")", "{", "$", "bAllowCreatingCodes", "=", "false", ";", "$", "oTargetTableConf", "=", "TdbCmsTblConf", "::", "GetNewInstance", "(", ")", ";", "/** @var $oTargetTableConf TdbCmsTblConf */", "if", "(", "$", "oT...
return true if the current user has the right to create codes in the shop_voucher table. @return bool
[ "return", "true", "if", "the", "current", "user", "has", "the", "right", "to", "create", "codes", "in", "the", "shop_voucher", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L134-L148
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php
TCMSShopTableEditor_ShopVoucherSeries.ExportVoucherCodes
public function ExportVoucherCodes() { $sReturn = ''; if ($this->AllowExportingVoucherCodes()) { $oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'"); $oVouchers->GoToStart(); $count = 0; while ($oVoucher = $oVouchers->Next()) { $aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode); if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) { $aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated)); } else { $aCsvVouchers[$count][3] = ''; } $aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp; if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) { $aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp)); } else { $aCsvVouchers[$count][3] = ''; } ++$count; } $sCsv = ''; for ($i = 0; $i < count($aCsvVouchers); ++$i) { $sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n"; } $sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv; while (@ob_end_clean()) { } header('Cache-Control: must-revalidate'); header('Pragma: must-revalidate'); header('Content-type: application/csv'); header('Content-disposition: attachment; filename=ShopVouchers.csv'); echo $sCsv; exit(0); } else { echo 'Keine Berechtigung'; } }
php
public function ExportVoucherCodes() { $sReturn = ''; if ($this->AllowExportingVoucherCodes()) { $oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'"); $oVouchers->GoToStart(); $count = 0; while ($oVoucher = $oVouchers->Next()) { $aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode); if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) { $aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated)); } else { $aCsvVouchers[$count][3] = ''; } $aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp; if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) { $aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp)); } else { $aCsvVouchers[$count][3] = ''; } ++$count; } $sCsv = ''; for ($i = 0; $i < count($aCsvVouchers); ++$i) { $sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n"; } $sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv; while (@ob_end_clean()) { } header('Cache-Control: must-revalidate'); header('Pragma: must-revalidate'); header('Content-type: application/csv'); header('Content-disposition: attachment; filename=ShopVouchers.csv'); echo $sCsv; exit(0); } else { echo 'Keine Berechtigung'; } }
[ "public", "function", "ExportVoucherCodes", "(", ")", "{", "$", "sReturn", "=", "''", ";", "if", "(", "$", "this", "->", "AllowExportingVoucherCodes", "(", ")", ")", "{", "$", "oVouchers", "=", "TdbShopVoucherList", "::", "GetList", "(", "\"SELECT * FROM `shop...
export all vouchers from a voucher series as csv-file with Code, Datecreated and UsedUp-Information.
[ "export", "all", "vouchers", "from", "a", "voucher", "series", "as", "csv", "-", "file", "with", "Code", "Datecreated", "and", "UsedUp", "-", "Information", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L173-L216
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php
TShopPaymentHandlerOgoneAliasGateway.GetAllInputFieldParameter
protected function GetAllInputFieldParameter() { $aParameter = array(); $aParameter['PSPID'] = $this->GetConfigParameter('user_id'); $aParameter['ACCEPTURL'] = $this->GetSuccessURL(); $aParameter['EXCEPTIONURL'] = $this->GetErrorURL(); // if the user already requested an alias we want to update that existing one so we need the given order id (ref from ogone) and the alias for the hashing too if (isset($this->aPaymentUserData['ORDERID']) && '' !== $this->aPaymentUserData['ORDERID']) { $aParameter['ORDERID'] = $this->aPaymentUserData['ORDERID']; } if (isset($this->aPaymentUserData['ALIAS']) && '' !== $this->aPaymentUserData['ALIAS']) { $aParameter['ALIAS'] = $this->aPaymentUserData['ALIAS']; } $aHashParameter = $aParameter; $aParameter['SHASIGN'] = $this->BuildOutgoingHash($aHashParameter); return $aParameter; }
php
protected function GetAllInputFieldParameter() { $aParameter = array(); $aParameter['PSPID'] = $this->GetConfigParameter('user_id'); $aParameter['ACCEPTURL'] = $this->GetSuccessURL(); $aParameter['EXCEPTIONURL'] = $this->GetErrorURL(); // if the user already requested an alias we want to update that existing one so we need the given order id (ref from ogone) and the alias for the hashing too if (isset($this->aPaymentUserData['ORDERID']) && '' !== $this->aPaymentUserData['ORDERID']) { $aParameter['ORDERID'] = $this->aPaymentUserData['ORDERID']; } if (isset($this->aPaymentUserData['ALIAS']) && '' !== $this->aPaymentUserData['ALIAS']) { $aParameter['ALIAS'] = $this->aPaymentUserData['ALIAS']; } $aHashParameter = $aParameter; $aParameter['SHASIGN'] = $this->BuildOutgoingHash($aHashParameter); return $aParameter; }
[ "protected", "function", "GetAllInputFieldParameter", "(", ")", "{", "$", "aParameter", "=", "array", "(", ")", ";", "$", "aParameter", "[", "'PSPID'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'user_id'", ")", ";", "$", "aParameter", "[", "...
Get all needed parameter for first request to. @return array
[ "Get", "all", "needed", "parameter", "for", "first", "request", "to", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L46-L65
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php
TShopPaymentHandlerOgoneAliasGateway.GetErrorURL
protected function GetErrorURL($sStepName = '') { if (empty($sStepName)) { $sStepName = 'shipping'; } $sURL = false; $oShippingStep = TdbShopOrderStep::GetStep($sStepName); /** @var $oShippingStep TdbShopOrderStep */ if (!is_null($oShippingStep)) { $sURL = $oShippingStep->GetStepURL(true, true); if ('/' == substr($sURL, -1)) { $sURL = substr($sURL, 0, -1); } } return $sURL; }
php
protected function GetErrorURL($sStepName = '') { if (empty($sStepName)) { $sStepName = 'shipping'; } $sURL = false; $oShippingStep = TdbShopOrderStep::GetStep($sStepName); /** @var $oShippingStep TdbShopOrderStep */ if (!is_null($oShippingStep)) { $sURL = $oShippingStep->GetStepURL(true, true); if ('/' == substr($sURL, -1)) { $sURL = substr($sURL, 0, -1); } } return $sURL; }
[ "protected", "function", "GetErrorURL", "(", "$", "sStepName", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "sStepName", ")", ")", "{", "$", "sStepName", "=", "'shipping'", ";", "}", "$", "sURL", "=", "false", ";", "$", "oShippingStep", "=", "T...
defines the error url of the "get alias" call by default we only want to return to the shipping step. @param string $sStepName @return string
[ "defines", "the", "error", "url", "of", "the", "get", "alias", "call", "by", "default", "we", "only", "want", "to", "return", "to", "the", "shipping", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L106-L122
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php
TShopPaymentHandlerOgoneAliasGateway.GetUserPaymentData
protected function GetUserPaymentData() { parent::GetUserPaymentData(); $oGlobal = TGlobal::instance(); //if no new payment data was submitted try to get the data from the active payment method if (!$oGlobal->UserDataExists(TdbShopPaymentHandler::URL_PAYMENT_USER_INPUT) && !isset($this->aPaymentUserData['NCERROR'])) { $oBasket = TShopBasket::GetInstance(); $oPaymentMethod = &$oBasket->GetActivePaymentMethod(); if (null !== $oPaymentMethod) { $oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler(); if ($oPaymentHandler instanceof self) { $this->aPaymentUserData = $oPaymentHandler->GetUserPaymentDataWithoutLoading(); } } } $this->MapExpireDateFromAPI(); $this->HandleError(); return $this->aPaymentUserData; }
php
protected function GetUserPaymentData() { parent::GetUserPaymentData(); $oGlobal = TGlobal::instance(); //if no new payment data was submitted try to get the data from the active payment method if (!$oGlobal->UserDataExists(TdbShopPaymentHandler::URL_PAYMENT_USER_INPUT) && !isset($this->aPaymentUserData['NCERROR'])) { $oBasket = TShopBasket::GetInstance(); $oPaymentMethod = &$oBasket->GetActivePaymentMethod(); if (null !== $oPaymentMethod) { $oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler(); if ($oPaymentHandler instanceof self) { $this->aPaymentUserData = $oPaymentHandler->GetUserPaymentDataWithoutLoading(); } } } $this->MapExpireDateFromAPI(); $this->HandleError(); return $this->aPaymentUserData; }
[ "protected", "function", "GetUserPaymentData", "(", ")", "{", "parent", "::", "GetUserPaymentData", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "//if no new payment data was submitted try to get the data from the active payment method", ...
load user payment data overload the payment data with post data or the data of the active payment handler from the basket object if there is one. @return array
[ "load", "user", "payment", "data", "overload", "the", "payment", "data", "with", "post", "data", "or", "the", "data", "of", "the", "active", "payment", "handler", "from", "the", "basket", "object", "if", "there", "is", "one", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L163-L183
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php
TShopPaymentHandlerOgoneAliasGateway.MapExpireDateFromAPI
protected function MapExpireDateFromAPI() { if (isset($this->aPaymentUserData['ED']) && '' !== $this->aPaymentUserData['ED']) { $this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_MONTH'] = substr($this->aPaymentUserData['ED'], 0, 2); $this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_YEAR'] = '20'.substr($this->aPaymentUserData['ED'], 2, 2); } }
php
protected function MapExpireDateFromAPI() { if (isset($this->aPaymentUserData['ED']) && '' !== $this->aPaymentUserData['ED']) { $this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_MONTH'] = substr($this->aPaymentUserData['ED'], 0, 2); $this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_YEAR'] = '20'.substr($this->aPaymentUserData['ED'], 2, 2); } }
[ "protected", "function", "MapExpireDateFromAPI", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aPaymentUserData", "[", "'ED'", "]", ")", "&&", "''", "!==", "$", "this", "->", "aPaymentUserData", "[", "'ED'", "]", ")", "{", "$", "this", "-...
the api only returns concatenated date instead of month and year in single fields so we want to map them because we use the single fields for submitting.
[ "the", "api", "only", "returns", "concatenated", "date", "instead", "of", "month", "and", "year", "in", "single", "fields", "so", "we", "want", "to", "map", "them", "because", "we", "use", "the", "single", "fields", "for", "submitting", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L189-L195
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php
TShopPaymentHandlerOgoneAliasGateway.HandleError
protected function HandleError() { static $bErrorsHandled = false; if (!$bErrorsHandled) { $bErrorsHandled = true; $oMessageManager = TCMSMessageManager::GetInstance(); $oGlobal = TGlobal::instance(); $aErrorFields = $this->GetErrorFields(); $aReturnedParameter = $oGlobal->GetUserData(); $aTrackedErrors = array(); $sConsumerName = self::MSG_MANAGER_NAME; foreach ($aErrorFields as $sErrorField) { if (array_key_exists($sErrorField, $aReturnedParameter) && $aReturnedParameter[$sErrorField] > 0) { if (!in_array($aReturnedParameter[$sErrorField], $aTrackedErrors)) { TTools::WriteLogEntry('OGONE Alias Gateway: error from alias gateway call: '.$sErrorField.'-'.$aReturnedParameter[$sErrorField], 1, __FILE__, __LINE__); $oMessageManager->AddMessage($sConsumerName, 'PAYMENT-HANDLER-OGONE-ALIAS-GATEWAY-ERROR-'.$sErrorField.'-'.$aReturnedParameter[$sErrorField]); $aTrackedErrors[] = $aReturnedParameter[$sErrorField]; } } } } }
php
protected function HandleError() { static $bErrorsHandled = false; if (!$bErrorsHandled) { $bErrorsHandled = true; $oMessageManager = TCMSMessageManager::GetInstance(); $oGlobal = TGlobal::instance(); $aErrorFields = $this->GetErrorFields(); $aReturnedParameter = $oGlobal->GetUserData(); $aTrackedErrors = array(); $sConsumerName = self::MSG_MANAGER_NAME; foreach ($aErrorFields as $sErrorField) { if (array_key_exists($sErrorField, $aReturnedParameter) && $aReturnedParameter[$sErrorField] > 0) { if (!in_array($aReturnedParameter[$sErrorField], $aTrackedErrors)) { TTools::WriteLogEntry('OGONE Alias Gateway: error from alias gateway call: '.$sErrorField.'-'.$aReturnedParameter[$sErrorField], 1, __FILE__, __LINE__); $oMessageManager->AddMessage($sConsumerName, 'PAYMENT-HANDLER-OGONE-ALIAS-GATEWAY-ERROR-'.$sErrorField.'-'.$aReturnedParameter[$sErrorField]); $aTrackedErrors[] = $aReturnedParameter[$sErrorField]; } } } } }
[ "protected", "function", "HandleError", "(", ")", "{", "static", "$", "bErrorsHandled", "=", "false", ";", "if", "(", "!", "$", "bErrorsHandled", ")", "{", "$", "bErrorsHandled", "=", "true", ";", "$", "oMessageManager", "=", "TCMSMessageManager", "::", "Get...
handle error codes from the api.
[ "handle", "error", "codes", "from", "the", "api", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L215-L236
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVatList.class.php
TShopVatList.GetTotalVatValue
public function GetTotalVatValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->GetVatValue(); } $this->setItemPointer($iPointer); return $dVal; }
php
public function GetTotalVatValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->GetVatValue(); } $this->setItemPointer($iPointer); return $dVal; }
[ "public", "function", "GetTotalVatValue", "(", ")", "{", "$", "dVal", "=", "0", ";", "$", "iPointer", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$",...
get the total vat value for the current group. @return float
[ "get", "the", "total", "vat", "value", "for", "the", "current", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L19-L30
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVatList.class.php
TShopVatList.GetTotalNetValue
public function GetTotalNetValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->getNetValue(); } $this->setItemPointer($iPointer); return $dVal; }
php
public function GetTotalNetValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->getNetValue(); } $this->setItemPointer($iPointer); return $dVal; }
[ "public", "function", "GetTotalNetValue", "(", ")", "{", "$", "dVal", "=", "0", ";", "$", "iPointer", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$",...
get the total net value for the current group. @return float
[ "get", "the", "total", "net", "value", "for", "the", "current", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L37-L48
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVatList.class.php
TShopVatList.GetTotalValue
public function GetTotalValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->getTotalValue(); } $this->setItemPointer($iPointer); return $dVal; }
php
public function GetTotalValue() { $dVal = 0; $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { $dVal += $oItem->getTotalValue(); } $this->setItemPointer($iPointer); return $dVal; }
[ "public", "function", "GetTotalValue", "(", ")", "{", "$", "dVal", "=", "0", ";", "$", "iPointer", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$", ...
get the total gross value for the current group. @return float
[ "get", "the", "total", "gross", "value", "for", "the", "current", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L55-L66
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVatList.class.php
TShopVatList.GetMaxItem
public function GetMaxItem() { /** @var $oMaxItem null|TdbShopVat */ $oMaxItem = null; $iPt = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->getTotalValue() > 0 && (is_null($oMaxItem) || $oItem->getTotalValue() > $oMaxItem->getTotalValue())) { $oMaxItem = $oItem; } } $this->setItemPointer($iPt); return $oMaxItem; }
php
public function GetMaxItem() { /** @var $oMaxItem null|TdbShopVat */ $oMaxItem = null; $iPt = $this->getItemPointer(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->getTotalValue() > 0 && (is_null($oMaxItem) || $oItem->getTotalValue() > $oMaxItem->getTotalValue())) { $oMaxItem = $oItem; } } $this->setItemPointer($iPt); return $oMaxItem; }
[ "public", "function", "GetMaxItem", "(", ")", "{", "/** @var $oMaxItem null|TdbShopVat */", "$", "oMaxItem", "=", "null", ";", "$", "iPt", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(",...
return largest item in list. @return TdbShopVat
[ "return", "largest", "item", "in", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L73-L87
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterNoticeList.class.php
TShopModuleArticlelistFilterNoticeList.CreateTempNotice
protected function CreateTempNotice($aNoticeList) { $sTmpTableName = MySqlLegacySupport::getInstance()->real_escape_string('_tmp'.session_id().'noticelist'); $query = "CREATE TEMPORARY TABLE `{$sTmpTableName}` ( `date_added` datetime NOT NULL, `shop_article_id` char(36) NOT NULL, `amount` decimal(10,2) NOT NULL default '1.00', KEY `shop_article_id` (`shop_article_id`), KEY `date_added` (`date_added`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8"; MySqlLegacySupport::getInstance()->query($query); reset($aNoticeList); foreach ($aNoticeList as $iArticleId => $oNoteItem) { /** @var $oNoteItem TdbShopUserNoticeList */ $query = "INSERT INTO `{$sTmpTableName}` SET `date_added` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldDateAdded)."', `shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldShopArticleId)."', `amount` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldAmount)."' "; MySqlLegacySupport::getInstance()->query($query); } return $sTmpTableName; }
php
protected function CreateTempNotice($aNoticeList) { $sTmpTableName = MySqlLegacySupport::getInstance()->real_escape_string('_tmp'.session_id().'noticelist'); $query = "CREATE TEMPORARY TABLE `{$sTmpTableName}` ( `date_added` datetime NOT NULL, `shop_article_id` char(36) NOT NULL, `amount` decimal(10,2) NOT NULL default '1.00', KEY `shop_article_id` (`shop_article_id`), KEY `date_added` (`date_added`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8"; MySqlLegacySupport::getInstance()->query($query); reset($aNoticeList); foreach ($aNoticeList as $iArticleId => $oNoteItem) { /** @var $oNoteItem TdbShopUserNoticeList */ $query = "INSERT INTO `{$sTmpTableName}` SET `date_added` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldDateAdded)."', `shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldShopArticleId)."', `amount` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldAmount)."' "; MySqlLegacySupport::getInstance()->query($query); } return $sTmpTableName; }
[ "protected", "function", "CreateTempNotice", "(", "$", "aNoticeList", ")", "{", "$", "sTmpTableName", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "'_tmp'", ".", "session_id", "(", ")", ".", "'noticelist'", ")", ";",...
Crete temp notice list table for guest users and returns temp table name. @param array $aNoticeList @return string
[ "Crete", "temp", "notice", "list", "table", "for", "guest", "users", "and", "returns", "temp", "table", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterNoticeList.class.php#L89-L112
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.createEmptyDtoFromEntityFqn
public function createEmptyDtoFromEntityFqn(string $entityFqn) { $dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($entityFqn); $dto = new $dtoFqn(); $this->resetCreationTransaction(); $this->createdDtos[$dtoFqn] = $dto; $this->setId($dto); $this->addRequiredItemsToDto($dto); $this->resetCreationTransaction(); return $dto; }
php
public function createEmptyDtoFromEntityFqn(string $entityFqn) { $dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($entityFqn); $dto = new $dtoFqn(); $this->resetCreationTransaction(); $this->createdDtos[$dtoFqn] = $dto; $this->setId($dto); $this->addRequiredItemsToDto($dto); $this->resetCreationTransaction(); return $dto; }
[ "public", "function", "createEmptyDtoFromEntityFqn", "(", "string", "$", "entityFqn", ")", "{", "$", "dtoFqn", "=", "$", "this", "->", "namespaceHelper", "->", "getEntityDtoFqnFromEntityFqn", "(", "$", "entityFqn", ")", ";", "$", "dto", "=", "new", "$", "dtoFq...
Pass in the FQN for an entity and get an empty DTO, including nested empty DTOs for required relations @param string $entityFqn @return mixed
[ "Pass", "in", "the", "FQN", "for", "an", "entity", "and", "get", "an", "empty", "DTO", "including", "nested", "empty", "DTOs", "for", "required", "relations" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L47-L59
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.setId
private function setId(DataTransferObjectInterface $dto): void { $entityFqn = $dto::getEntityFqn(); $reflection = $this->getDsmFromEntityFqn($entityFqn) ->getReflectionClass(); if ($reflection->implementsInterface(UuidPrimaryKeyInterface::class)) { $dto->setId($entityFqn::buildUuid($this->uuidFactory)); } }
php
private function setId(DataTransferObjectInterface $dto): void { $entityFqn = $dto::getEntityFqn(); $reflection = $this->getDsmFromEntityFqn($entityFqn) ->getReflectionClass(); if ($reflection->implementsInterface(UuidPrimaryKeyInterface::class)) { $dto->setId($entityFqn::buildUuid($this->uuidFactory)); } }
[ "private", "function", "setId", "(", "DataTransferObjectInterface", "$", "dto", ")", ":", "void", "{", "$", "entityFqn", "=", "$", "dto", "::", "getEntityFqn", "(", ")", ";", "$", "reflection", "=", "$", "this", "->", "getDsmFromEntityFqn", "(", "$", "enti...
If the Entity that the DTO represents has a settable and buildable UUID, then we should set that at the point of creating a DTO for a new Entity instance @param DataTransferObjectInterface $dto
[ "If", "the", "Entity", "that", "the", "DTO", "represents", "has", "a", "settable", "and", "buildable", "UUID", "then", "we", "should", "set", "that", "at", "the", "point", "of", "creating", "a", "DTO", "for", "a", "new", "Entity", "instance" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L82-L90
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.addNestedRequiredDtos
private function addNestedRequiredDtos(DataTransferObjectInterface $dto): void { $entityFqn = $dto::getEntityFqn(); $dsm = $this->getDsmFromEntityFqn($entityFqn); $requiredRelations = $dsm->getRequiredRelationProperties(); foreach ($requiredRelations as $propertyName => $types) { $numTypes = count($types); if (1 !== $numTypes) { throw new \RuntimeException('Unexpected number of types, only expecting 1: ' . print_r($types, true)); } $entityInterfaceFqn = $types[0]; $getter = 'get' . $propertyName; if ('[]' === substr($entityInterfaceFqn, -2)) { if ($dto->$getter()->count() > 0) { continue; } $entityInterfaceFqn = substr($entityInterfaceFqn, 0, -2); $this->addNestedDtoToCollection($dto, $propertyName, $entityInterfaceFqn); continue; } $issetAsDtoMethod = 'isset' . $propertyName . 'AsDto'; $issetAsEntityMethod = 'isset' . $propertyName . 'AsEntity'; if (true === $dto->$issetAsDtoMethod() || true === $dto->$issetAsEntityMethod()) { continue; } $this->addNestedDto($dto, $propertyName, $entityInterfaceFqn); } }
php
private function addNestedRequiredDtos(DataTransferObjectInterface $dto): void { $entityFqn = $dto::getEntityFqn(); $dsm = $this->getDsmFromEntityFqn($entityFqn); $requiredRelations = $dsm->getRequiredRelationProperties(); foreach ($requiredRelations as $propertyName => $types) { $numTypes = count($types); if (1 !== $numTypes) { throw new \RuntimeException('Unexpected number of types, only expecting 1: ' . print_r($types, true)); } $entityInterfaceFqn = $types[0]; $getter = 'get' . $propertyName; if ('[]' === substr($entityInterfaceFqn, -2)) { if ($dto->$getter()->count() > 0) { continue; } $entityInterfaceFqn = substr($entityInterfaceFqn, 0, -2); $this->addNestedDtoToCollection($dto, $propertyName, $entityInterfaceFqn); continue; } $issetAsDtoMethod = 'isset' . $propertyName . 'AsDto'; $issetAsEntityMethod = 'isset' . $propertyName . 'AsEntity'; if (true === $dto->$issetAsDtoMethod() || true === $dto->$issetAsEntityMethod()) { continue; } $this->addNestedDto($dto, $propertyName, $entityInterfaceFqn); } }
[ "private", "function", "addNestedRequiredDtos", "(", "DataTransferObjectInterface", "$", "dto", ")", ":", "void", "{", "$", "entityFqn", "=", "$", "dto", "::", "getEntityFqn", "(", ")", ";", "$", "dsm", "=", "$", "this", "->", "getDsmFromEntityFqn", "(", "$"...
Take the DTO for a defined EntityFqn and then parse the required relations and create nested DTOs for them Checks if the required relation is already set and if so, does nothing @param DataTransferObjectInterface $dto @throws \ReflectionException @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
[ "Take", "the", "DTO", "for", "a", "defined", "EntityFqn", "and", "then", "parse", "the", "required", "relations", "and", "create", "nested", "DTOs", "for", "them" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L120-L147
train