echo date("\nY-d-m H:i:s") . " - reindex start\n"; passthru("php indexer.php reindexall"); echo date("\nY-d-m H:i:s") . " - reindex finish\n"; //enable cache /*$model = Mage::getModel('core/cache'); $options = $model->canUse(); foreach($options as $option=>$value) { $options[$option] = 1; } $model->saveOptions($options);*/ } } echo date("\nY-d-m H:i:s") . " - LENS START\n"; #$attrId = Mage::getModel('eav/entity_attribute_set')->getCollection()->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )->addFilter('attribute_set_name', 'Lenses')->getFirstItem()->getId(); #Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('attribute_set_id', $attrId)->delete(); $l = new Lenses(); //$catId = $l->createCategory(); //$setId = $l->createAttributeSetOnSkeletonSet(); //$l->createAttributeGroup($setId); //$l->addImages(); //$l->addLenses(); //add options $l->deleteOptions(); $l->prepare($l->header_lens_type, $l->values_lens_type); $l->prepare($l->header_lens_thickness, $l->values_lens_thickness); $l->prepare($l->header_lens_tint, $l->values_lens_tint); $l->prepare($l->header_lens_coating, $l->values_lens_coating); $l->prepare($l->header_lens_glasses_for, $l->values_lens_glasses_for); $l->prepare($l->header_lens_varifocal_type, $l->values_lens_varifocal_type); //add prescripted options $l->prepare($l->header_sphere_right, $l->values_sphere_right);
$options[$option] = 1; } $model->saveOptions($options);*/ } public function changeData() { $id = Mage::getModel('catalog/product')->getIdBySku($this->data[0]['sku']); $product = Mage::getModel('catalog/product')->load($id); $product->setStockData(array('is_in_stock' => 1, 'qty' => 10000)); $product->save(); } } echo date("\nY-d-m H:i:s") . " - LENS START\n"; #$attrId = Mage::getModel('eav/entity_attribute_set')->getCollection()->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )->addFilter('attribute_set_name', 'Lenses')->getFirstItem()->getId(); #Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('attribute_set_id', $attrId)->delete(); $l = new Lenses(); $catId = $l->createCategory(); //$setId = $l->createAttributeSetOnSkeletonSet(); //$l->createAttributeGroup($setId); //$l->addImages(); //$l->addLenses(); //$l->changeData(); die; //add options //$l->deleteOptions(); //$l->prepare($l->header_lens_type, $l->values_lens_type); //$l->prepare($l->header_lens_thickness, $l->values_lens_thickness); //$l->prepare($l->header_lens_glasses_for, $l->values_lens_glasses_for); //$l->prepare($l->header_lens_varifocal_type, $l->values_lens_varifocal_type); //$l->prepare($l->header_lens_tint, $l->values_lens_tint); //$l->prepare($l->header_lens_tint_depth, $l->values_lens_tint_depth); //$l->prepare($l->header_lens_coating, $l->values_lens_coating);
return $arrIds; } public function getAttributeOptionIdByName($attribute_code, $attribute_value_name) { $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code); $array = array(); foreach ($attribute->getSource()->getAllOptions(false) as $option) { if ($option['label'] == $attribute_value_name) { return $option['value']; } } } } echo date("\nY-d-m H:i:s") . " - LENS START\n"; // # Mage::getModel('catalog/product')->getCollection()->delete(); $l = new Lenses(); $catId = $l->createCategory(); //$l->addImages(); $l->addLenses(); //add options //$l->prepare($l->header_lens_thickness, $l->values_lens_thickness); //$l->prepare($l->header_lens_varifocal_type, $l->values_lens_varifocal_type); //$l->prepare($l->header_lens_coating, $l->values_lens_coating); //add prescripted options $l->prepare($l->header_sphere_left, $l->values_sphere_left); $l->prepare($l->header_cylinder_left, $l->values_cylinder_left); $l->prepare($l->header_axis_left, $l->values_axis_left); $l->prepare($l->header_nearadd_left, $l->values_nearadd_left); $l->prepare($l->header_sphere_right, $l->values_sphere_right); $l->prepare($l->header_cylinder_right, $l->values_cylinder_right); $l->prepare($l->header_axis_right, $l->values_axis_right);
return $arrIds; } public function getAttributeOptionIdByName($attribute_code, $attribute_value_name) { $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code); $array = array(); foreach ($attribute->getSource()->getAllOptions(false) as $option) { if ($option['label'] == $attribute_value_name) { return $option['value']; } } } } echo date("\nY-d-m H:i:s") . " - LENS START\n"; // # Mage::getModel('catalog/product')->getCollection()->delete(); $l = new Lenses(); $catId = $l->createCategory(); //$l->addImages(); $l->deleteOptions(); //die; //$l->addLenses(); //add options //$l->prepare($l->header_lens_thickness, $l->values_lens_thickness); //$l->prepare($l->header_lens_varifocal_type, $l->values_lens_varifocal_type); //$l->prepare($l->header_lens_coating, $l->values_lens_coating); //add prescripted options $l->prepare($l->header_sphere_left, $l->values_sphere_left); $l->prepare($l->header_cylinder_left, $l->values_cylinder_left); $l->prepare($l->header_axis_left, $l->values_axis_left); $l->prepare($l->header_nearadd_left, $l->values_nearadd_left); $l->prepare($l->header_sphere_right, $l->values_sphere_right);