Example #1
0
 function customSortingSQL($params)
 {
     $multipriceTableAlias = "mp";
     if (isset($params['table_alias_suffix'])) {
         $multipriceTableAlias .= $params['table_alias_suffix'];
     }
     $sql = array('from' => '', 'where' => '', 'sorting_field' => '');
     $sql['from'] = "ezmultipricedata {$multipriceTableAlias}";
     $and = '';
     if (isset($params['contentobject_attr_id'])) {
         $sql['where'] = "\n                     {$multipriceTableAlias}.contentobject_attr_id = {$params['contentobject_attr_id']}";
         $and = ' AND';
     }
     if (isset($params['contentobject_attr_version'])) {
         $sql['where'] .= "\n                    {$and} {$multipriceTableAlias}.contentobject_attr_version = {$params['contentobject_attr_version']}";
         $and = ' AND';
     }
     if (!isset($params['currency_code'])) {
         $params['currency_code'] = eZShopFunctions::preferredCurrencyCode();
     }
     if ($params['currency_code'] !== false) {
         $sql['where'] .= "\n                    {$and} {$multipriceTableAlias}.currency_code = '{$params['currency_code']}'";
         $and = ' AND';
     }
     $sql['sorting_field'] = "{$multipriceTableAlias}.value";
     return $sql;
 }
    function fetchPreferredCurrencyCode()
    {
        $currency = eZShopFunctions::preferredCurrencyCode();
        $result = array( 'result' => $currency );

        return $result;
    }
Example #3
0
 static function isPreferredCurrencyValid($currencyCode = false)
 {
     $error = eZError::SHOP_OK;
     if ($currencyCode === false) {
         $currencyCode = eZShopFunctions::preferredCurrencyCode();
     }
     $currency = eZCurrencyData::fetch($currencyCode);
     if ($currency) {
         if (!$currency->isActive()) {
             $error = eZError::SHOP_PREFERRED_CURRENCY_INACTIVE;
             eZDebug::writeWarning("Currency '{$currencyCode}' is inactive.", __METHOD__);
         }
     } else {
         $error = eZError::SHOP_PREFERRED_CURRENCY_DOESNOT_EXIST;
         eZDebug::writeWarning("Currency '{$currencyCode}' doesn't exist", __METHOD__);
     }
     return $error;
 }
Example #4
0
 function preferredCurrencyCode()
 {
     return eZShopFunctions::preferredCurrencyCode();
 }