пожалуйста, посетите мой URL-адрес и посмотрите
https://staging.raptorsupplies.com/cata ... ?q=baldwin
вы нажимаете первым продукт также вы можете увидеть этот продукт, показывающий
введите описание изображения здесь
если нажать на него, то появится ошибка, например
и если щелкнуть другой продукт, он откроется и будет работать, потому что в списке вариаций/коллекций меньше, но он в 1500 вариациях
Я создал нумерацию страниц для этого запроса, но я все еще сталкиваюсь с ошибкой
вы можете увидеть мой код, где есть ошибка, я думаю, ошибка в нумерации страниц, но я ее понимаю, покажите, пожалуйста, кто-нибудь может мне помочь< /p>
[введите здесь описание изображения][2]
public function getConfigAttribOption($childProductList, $attribbid = NULL, $AllchildProductList = null) {
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$storeId = Mage::app()->getStore()->getStoreId(); //die;
if ($attribbid > 0) {
$SqlAttributeID = "select distinct attribute_id from eav_attribute_option where option_id in($attribbid)";
$RowAttributeID = $this->executeQuery($SqlAttributeID);
foreach ($RowAttributeID as $arrKey => $Arrval) {
$arrAttributeId[] = $Arrval['attribute_id'];
}
$attributeids = implode(',', $arrAttributeId);
$sqlConfigurableAttribute = "select a.attribute_id as id,a.frontend_label as label,a.attribute_code as attribute_code,group_concat(distinct i.value) as option_id,GROUP_CONCAT(DISTINCT o.value SEPARATOR '&|&') as option_value from catalog_product_entity_int as i join eav_attribute as a on i.attribute_id=a.attribute_id JOIN eav_attribute_option_value AS o ON i.value=o.option_id where o.store_id=".$storeId." and (a.attribute_id in(81,92) OR a.attribute_id>20000) and entity_id in($childProductList) AND a.attribute_id NOT IN($attributeids) group by i.attribute_id having count(distinct i.value)>1";
$arrCount = 0;
mysql_query('SET SESSION group_concat_max_len=10000');
foreach ($arrAttributeId as $key => $val) {
if ($arrCount == count($attribbid) - 1) {
$sqlCheckedAttribute.=" union all SELECT a.attribute_id AS id,a.frontend_label AS label,a.attribute_code AS attribute_code,IF(COUNT(DISTINCT i.value)>1,GROUP_CONCAT(DISTINCT i.value),'') AS option_id,GROUP_CONCAT(DISTINCT o.value SEPARATOR '&|&') AS option_value FROM catalog_product_entity_int AS i JOIN eav_attribute AS a ON i.attribute_id=a.attribute_id JOIN eav_attribute_option_value AS o ON i.value=o.option_id WHERE o.store_id=".$storeId." and (a.attribute_id in(81,92) OR a.attribute_id>20000) AND entity_id in(" . $AllchildProductList . ") AND a.attribute_id=" . $val . " GROUP BY i.attribute_id ";
} else {
$sqlCheckedAttribute.=" union all SELECT a.attribute_id AS id,a.frontend_label AS label,a.attribute_code AS attribute_code,IF(COUNT(DISTINCT i.value)>1,GROUP_CONCAT(DISTINCT i.value),'') AS option_id,GROUP_CONCAT(DISTINCT o.value SEPARATOR '&|&') AS option_value FROM catalog_product_entity_int AS i JOIN eav_attribute AS a ON i.attribute_id=a.attribute_id JOIN eav_attribute_option_value AS o ON i.value=o.option_id WHERE o.store_id=".$storeId." and (a.attribute_id in(81,92) OR a.attribute_id>20000) AND entity_id in(" . $AllchildProductList . ") AND a.attribute_id=" . $val . " GROUP BY i.attribute_id ";
}
$arrCount = $arrCount + 1;
}
$sqlConfigurableAttribute = $sqlConfigurableAttribute . $sqlCheckedAttribute;
} else {
$sqlConfigurableAttribute = "select a.attribute_id as id,a.frontend_label as label,a.attribute_code as attribute_code,group_concat(distinct i.value) as option_id,GROUP_CONCAT(DISTINCT o.value SEPARATOR '&|&') as option_value from catalog_product_entity_int as i join eav_attribute as a on i.attribute_id=a.attribute_id JOIN eav_attribute_option_value AS o ON i.value=o.option_id where o.store_id=$storeId and (a.attribute_id in(81,92) OR a.attribute_id>20000) and entity_id in($childProductList) group by i.attribute_id having count(distinct i.value)>1";
}
$sqlConfigurableAttribute = $sqlConfigurableAttribute . " order by id"; //die;
$productAttributeOptions = $readConnection->fetchAll($sqlConfigurableAttribute);
return $productAttributeOptions;
}
public function executeQuery($query) {
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
return $readConnection->fetchAll($query);
}
function getRelativeOptionBlock($productId = null, $attribbid = null, $pageno = null) {
$encrypted_string=$this->getRequest()->getParam('active_filters');
$decrypted_string=urldecode(base64_decode($encrypted_string));
if($decrypted_string){
$attribbid=$decrypted_string;
$productId= $this->getProduct()->getId();
}
if ($attribbid && $productId) {
//$childProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($productId);
//$childProductList = implode(',', $childProducts[0]);
$AllchildProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($productId);
$AllchildProductList = implode(',', $AllchildProducts[0]);
$attribb = explode(',', $attribbid);
$query = 'SELECT eav_attribute.attribute_code FROM eav_attribute JOIN eav_attribute_option ON eav_attribute.attribute_id=eav_attribute_option.attribute_id WHERE option_id IN(' . $attribbid . ')';
$results = $this->executeQuery($query);
$attribvalue = $results['0']['attribute_code'];
$product = Mage::getModel('catalog/product')->load($productId);
$childProductsColl = Mage::getModel('catalog/product_type_configurable')
->getUsedProductCollection($product)
->addAttributeToSelect('*');
foreach ($results as $res) {
$childProducts = $childProductsColl->addFieldToFilter($res['attribute_code'], $attribb);
}
$childProductList = array();
foreach ($childProducts as $cp2) {
$childProductList[] = $cp2->getId();
}
$childProductList = implode(',', $childProductList);
} elseif ($productId) {
$childProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($productId);
$childProductList = implode(',', $childProducts[0]);
} else {
$childProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($this->getProduct()->getId());
$childProductList = implode(',', $childProducts[0]);
}
$attributeOptions = array();
$productAttributeTh = array();
$productAttributeId = array();
$resource = Mage::getSingleton('core/resource');
$writeConnection = $resource->getConnection('core_write');
$querytemp="SET group_concat_max_len=100000";
$writeConnection->query($querytemp);
$productAttributeOptions = $this->getConfigAttribOption($childProductList, $attribbid, $AllchildProductList);
Mage::getSingleton('core/session')->setOptionlength(count($productAttributeOptions));
$html = "";
$html .= "";
foreach ($productAttributeOptions as $productAttribute) {
$productAttributeTh[] = $productAttribute['label'];
$productAttributeThId[] = $productAttribute['id'];
$productAttributeThCode[] = $productAttribute['attribute_code'];
$productAttributeId = array();
$productAttributeVal = array();
$productAttributeId = explode(',', $productAttribute['option_id']);
$productAttributeVal = explode('&|&', $productAttribute['option_value']);
if((int)$productAttribute['id'] == 81)
{
$this->brandcount = count($productAttributeVal);
}
if((int)$productAttribute['id'] == 81 && count($productAttributeVal) ==1)
continue;
$attribute_to= count($productAttributeId);
$attribute_option=array();
for($i=0;$i $OptionVal) {
if((int)$productAttribute['id'] == 81 && count($attribute_option) ==1)
continue;
$attridarray = explode(',', $attribbid);
if (in_array($OptionKey, $attridarray)) {
//echo $attribbid.$OptionVal; die;
$html .= "". $OptionVal . "";
} else {
$html .= "" . $OptionVal . "";
}
}
$html .= "";
$html .= "";
}
Mage::getSingleton('core/session')->setAttributeIds($productAttributeThId);
$html .= "
";
return $html;
}
function getRelativeHeaderBlock($productId = null, $attribbid = null) {
$encrypted_string=$this->getRequest()->getParam('active_filters');
$decrypted_string=urldecode(base64_decode($encrypted_string));
if($decrypted_string){
$attribbid=$decrypted_string;
$productId= $this->getProduct()->getId();
}
if ($productId) {
$childProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($productId);
} else {
$childProducts = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($this->getProduct()->getId());
}
$childProductList = implode(',', $childProducts[0]);
$productAttributeTh = array();
$attribidvalue= array();
if ($attribbid) {
$attribb = explode(',', $attribbid);
$query = 'SELECT * FROM eav_attribute_option where option_id in(' . $attribbid . ')';
$results = $this->executeQuery($query);
foreach($results as $key=>$val){
$attribidvalue[]=$val['attribute_id'];
}
//$attribidvalue = $results['0']['attribute_id'];
}
$productAttributeOptions = $this->getConfigAttribOption($childProductList);
foreach ($productAttributeOptions as $productAttribute) {
$productAttributeTh[$productAttribute['id']] = $productAttribute['label'];
}
$Productdetail = Mage::getModel('catalog/product')->load($productId);
?>
Подробнее здесь: https://stackoverflow.com/questions/388 ... g-time-out
Настраиваемая коллекция продуктов magento 1500 с нумерацией страниц, но время ожидания не загружается ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Проблема с нумерацией страниц в Laravel: Коллекция методов::links не существует
Anonymous » » в форуме Php - 0 Ответы
- 31 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Проблема с пользовательской сортировкой и нумерацией страниц продуктов WooCommerce
Anonymous » » в форуме Php - 0 Ответы
- 10 Просмотры
-
Последнее сообщение Anonymous
-