public function getAttributesForProduct(ProductModel $p, $limitCids = "") { $csv_cat = $p->getCategories(); $attrs = null; $attrsv = null; $attr_arr = array(); $prod_attrs = array(); if ($limitCids != "") { $csv_cat = $limitCids; } if ($csv_cat != "") { $attrs = $this->attrModel->fetchAttributes(array("cid" => "asc"), array("atr_categories" => trim($csv_cat, ","))); } if ($attrs != null) { foreach ($attrs as $k => $attr) { $csv_attrv = $attr->getId() . ","; $attr_arr[$attr->getId()]['name'] = $attr->getName(); $attr_arr[$attr->getId()]['value'] = ""; $attr_arr[$attr->getId()]['default_vals'] = json_decode($attr->getDefault_vals(), true); } $csv_attrv = trim($csv_attrv, ","); $attrsv = $this->attrValModel->fetchAttributesVal(array(), array("atrv_product" => $p->getProductId())); if ($attrsv != null) { foreach ($attrsv as $k => $attrv) { if (isset($attr_arr[$attrv->getAid()]['name'])) { $attr_arr[$attrv->getAid()]['value'] = $attrv->getApValue(); } } } return $attr_arr; } return null; }