Projekt

Allgemein

Profil

GX-Bug #61315 » SOLDOUTRibbonAttributeStockCheckFix.patch

Till Tepelmann, 01.03.2019 20:06

Unterschiede anzeigen:

src/templates/Honeygrid/smarty/function.product_ribbons.php (date 1551467164000)
85 85
	$configurationStockCheckResult     = xtc_db_query($configurationStockCheckSql);
86 86
	$configurationStockCheckResultBool = xtc_db_fetch_array($configurationStockCheckResult)['configuration_value'];
87 87
	
88
	$configurationAttributesStockCheckSql        = 'SELECT configuration_value FROM configuration
89
                                           WHERE configuration_key = "ATTRIBUTE_STOCK_CHECK"';
90
	$configurationAttributesStockCheckResult     = xtc_db_query($configurationAttributesStockCheckSql);
91
	$configurationAttributesStockCheckResultBool = xtc_db_fetch_array($configurationAttributesStockCheckResult)['configuration_value'];
92
	
88 93
	$configurationAllowStockCheckout       = 'SELECT configuration_value FROM configuration
89 94
                                               WHERE configuration_key = "STOCK_ALLOW_CHECKOUT"';
90 95
	$configurationAllowStockCheckoutResult = xtc_db_query($configurationAllowStockCheckout);
......
151 156
			return $arrTemp;
152 157
		}
153 158
	}
154
	
155
	$hasAttributesQuery  = 'SELECT COUNT(*) AS cnt 
159
	if($configurationAttributesStockCheckResultBool !== 'false')
160
	{
161
		$hasAttributesQuery  = 'SELECT COUNT(*) AS cnt
156 162
							FROM products_attributes
157 163
							WHERE 
158 164
							    products_id = ' . (int)$p_params['product_id'];
159
	$hasAttributesResult = xtc_db_query($hasAttributesQuery);
160
	
161
	if(xtc_db_fetch_array($hasAttributesResult)['cnt'] !== '0')
162
	{
163
		$attributesSql    = 'SELECT COUNT(*) AS cnt 
165
		$hasAttributesResult = xtc_db_query($hasAttributesQuery);
166
		
167
		if(xtc_db_fetch_array($hasAttributesResult)['cnt'] !== '0')
168
		{
169
			$attributesSql    = 'SELECT COUNT(*) AS cnt
164 170
								FROM products_attributes
165 171
								WHERE 
166 172
								    products_id = ' . (int)$p_params['product_id'] . ' AND 
167 173
									attributes_stock > 0';
168
		$attributesResult = xtc_db_query($attributesSql);
169
		
170
		if(xtc_db_fetch_array($attributesResult)['cnt'] === '0')
171
		{
172
			$arrTemp['class'] = 'sold-out';
173
			$arrTemp['text']  = 'PRODUCT_RIBBON_SOLD_OUT';
174
			$attributesResult = xtc_db_query($attributesSql);
175
			
176
			if(xtc_db_fetch_array($attributesResult)['cnt'] === '0')
177
			{
178
				$arrTemp['class'] = 'sold-out';
179
				$arrTemp['text']  = 'PRODUCT_RIBBON_SOLD_OUT';
180
			}
174 181
		}
175 182
	}
176
	
177 183
	return $arrTemp;
178 184
}
179 185

  
    (1-1/1)