本文整理汇总了PHP中mage::d方法的典型用法代码示例。如果您正苦于以下问题:PHP mage::d方法的具体用法?PHP mage::d怎么用?PHP mage::d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mage
的用法示例。
在下文中一共展示了mage::d方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load()
{
#Mage::getModel('customer/customer')->getCollection()->delete();
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$connection->query('ALTER TABLE `customer_entity` AUTO_INCREMENT=1');
$count = sizeof($this->objects);
$i = 0;
foreach ($this->objects as $object) {
mage::d($object);
die;
//$this->addCustomer($object);
++$i;
echo floor($i * 100 / $count) . '% ';
}
}
示例2: addLenses
public function addLenses()
{
//mage::d($this->data); die;
foreach ($this->data as $d) {
mage::d($d);
$this->addProduct($d);
}
}
示例3: ini_set
<?
ini_set("memory_limit","1000M");
require_once '/home/www/production/app/Mage.php';
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
echo date("\nY-d-m H:i:s\n")."Begin\n";
$ids = Mage::getModel('catalogrule/rule')->getCollection()->getAllIds();
$collection = array();
foreach($ids as $id){
$rule = Mage::getModel('catalogrule/rule')->load($id);
$cond = unserialize($rule->getConditionsSerialized());
conditions($cond);
mage::d($cond);
$rule->setConditionsSerialized(serialize($cond));
$collection[] = $rule;
}
# set Attribute label instead of attribute id for export.
function conditions(&$cond){
if($cond['type'] == 'catalogrule/rule_condition_combine'){
foreach( $cond['conditions'] as &$c ){
if(is_array($c)){
conditions($c);
}
} unset($c); // need for accurate delete link!
}else{
//mage::D($cond);
switch( $cond['attribute'] ) {
示例4: tax_calculation_rule
public function tax_calculation_rule()
{
$items = Mage::getModel('tax/calculation_rule')->getCollection()->getItems();
foreach ($items as $item) {
$item->delete();
}
$this->conn->query('ALTER TABLE `tax_calculation_rule` AUTO_INCREMENT=1');
foreach ($this->objects['tax_calculation_rule'] as $item) {
$model = new Mage_Tax_Model_Calculation_Rule();
foreach ($item as $key => $value) {
$model->setData($key, $value);
}
try {
$model->save();
} catch (Exception $e) {
mage::d($e->getMessage());
}
}
}
示例5: loadAttributes
public function loadAttributes()
{
$optionText = file_get_contents('../var/import/attributes.txt');
$attrArray = unserialize($optionText);
//mage::d($attrArray);
//die;
//$model = Mage::getModel('catalog/resource_eav_attribute')->load(143)->delete(); die;
foreach ($attrArray as $attr) {
try {
$attr->getSource()->getAllOptions(false);
} catch (Exception $e) {
echo "yes";
die;
continue;
}
$model = Mage::getModel('catalog/resource_eav_attribute');
//mage::ms($model); die;
// if attribute_code already exists, renew it only.
if ($attributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $attr->getAttributeCode())) {
$model = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
#$model = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId)->delete();
//delete old attribute options. TODO: apply API for it.
$query = "DELETE ao FROM eav_attribute_option ao JOIN eav_attribute ea ON ao.attribute_id = ea.attribute_id AND ea.attribute_id ={$attributeId}";
$this->query($query);
}
$data = array('attribute_code' => $attr->getAttributeCode(), 'attribute_model' => $attr->getData('attribute_model'), 'backend_model' => $attr->getData('backend_model'), 'backend_type' => $attr->getData('backend_type'), 'backend_table' => $attr->getData('backend_table'), 'frontend_model' => $attr->getData('frontend_model'), 'frontend_input' => $attr->getData('frontend_input'), 'frontend_label' => $attr->getData('frontend_label'), 'frontend_class' => $attr->getData('frontend_class'), 'source_model' => $attr->getData('source_model'), 'is_required' => $attr->getData('is_required'), 'is_user_defined' => $attr->getData('is_user_defined'), 'default_value' => $attr->getData('default_value'), 'is_unique' => $attr->getData('is_unique'), 'note' => $attr->getData('note'), 'frontend_input_renderer' => $attr->getData('frontend_input_renderer'), 'is_global' => $attr->getData('is_global'), 'is_visible' => $attr->getData('is_visible'), 'is_searchable' => $attr->getData('is_searchable'), 'is_filterable' => $attr->getData('is_filterable'), 'is_comparable' => $attr->getData('is_comparable'), 'is_visible_on_front' => $attr->getData('is_visible_on_front'), 'is_html_allowed_on_front' => $attr->getData('is_html_allowed_on_front'), 'is_used_for_price_rules' => $attr->getData('is_used_for_price_rules'), 'is_filterable_in_search' => $attr->getData('is_filterable_in_search'), 'used_in_product_listing' => $attr->getData('used_in_product_listing'), 'used_for_sort_by' => $attr->getData('used_for_sort_by'), 'is_configurable' => $attr->getData('is_configurable'), 'apply_to' => $attr->getData('apply_to'), 'is_visible_in_advanced_search' => $attr->getData('is_visible_in_advanced_search'), 'position' => $attr->getData('position'), 'is_wysiwyg_enabled' => $attr->getData('is_wysiwyg_enabled'), 'is_used_for_promo_rules' => $attr->getData('is_used_for_promo_rules'));
if (!$attributeId) {
$model->addData($data);
$model->setEntityTypeId(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId());
} else {
$model->setDataChanges($data);
}
// set groups and sets
$connection = Mage::getModel('core/resource')->getConnection('core_read');
$select = $connection->select()->from(array('oasm' => 'oberig_attribute_set_mapping'), array('attribute_group_name', 'sort_order'))->joinInner(array('eas' => 'eav_attribute_set'), 'oasm.attribute_set_name = eas.attribute_set_name AND entity_type_id = 4', 'attribute_set_id')->joinInner(array('eag' => 'eav_attribute_group'), 'eag.attribute_set_id = eas.attribute_set_id AND eag.attribute_group_name = oasm.attribute_group_name', 'attribute_group_id')->where('attribute_code=?', $attr->getAttributeCode());
echo $select->__toString() . "\n";
$result = $connection->query($select)->fetchAll();
echo "-------------------------------------------------\n";
mage::D($result);
echo "-------------------------------------------------\n";
foreach ($result as $res) {
if ($attributeId) {
$model = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
}
$model->setAttributeSetId($res['attribute_set_id']);
$model->setAttributeGroupId($res['attribute_group_id']);
$model->setSortOrder($res['sort_order']);
if ($attributeId) {
try {
$model->save();
} catch (Exception $ex) {
echo "Error: " . $ex->getMessage() . "\n";
}
}
}
//end set groups and sets
//if( $attr->getAttributeCode() == 'lenstint' )
//{
try {
if (!$attributeId) {
$model->save();
echo $attr->getAttributeCode() . " ..........................ok. ID: " . $model->getId() . "\n";
}
$option['attribute_id'] = $model->getId();
$all_opts = $attr->getSource()->getAllOptions(false);
} catch (Exception $ex) {
echo "Error: " . $ex->getMessage() . "\n";
}
//add attribute options
foreach ($all_opts as $opt) {
$option['value']['option'][0] = $opt['label'];
mage::d($option);
//die;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeOption($option);
}
echo "Model " . $model->getAttributeCode() . " saved. options added ..........................ok. \n";
//$model = Mage::getModel('catalog/resource_eav_attribute')->load($model->getId())->delete(); //die;
//}
}
// set tax class options TODO: API
$this->query("insert ignore into tax_class select * from {$this->oldDB}.tax_class");
//die;
}
示例6: foreach
const OPTION_TYPE_DROP_DOWN = 'drop_down';
const OPTION_TYPE_RADIO = 'radio';
const OPTION_TYPE_CHECKBOX = 'checkbox';
const OPTION_TYPE_MULTIPLE = 'multiple';
const OPTION_TYPE_DATE = 'date';
const OPTION_TYPE_DATE_TIME = 'date_time';
const OPTION_TYPE_TIME = 'time';
*
*/
$product = Mage::getModel('catalog/product')->load($product_id);
foreach ($product->getOptions() as $o) {
$p = $o->getValues();
if ($o->getTitle() == 'Please select your frame size') {
$values = array();
foreach ($p as $v) {
$data = $v->getData();
foreach ($data as $dk => $dv) {
$values[$v->getId()][$dk] = $dv;
}
$o->setType($type);
$o->setSku('frame_size');
$o->setValues($values);
try {
$o->save();
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
}
}
mage::d($o->getData());
}
示例7: foreach
foreach ($_options as $option) {
//$renderer = $optBlock->getOptionRender( $optBlock->getGroupOfOption($option->getType() ) );
//$renderer['renderer'] = $optBlock->getLayout()->createBlock($renderer['block'])
//->setTemplate($renderer['template']);
//mage::d( $renderer['renderer']->setProduct($p)->setOption($option)->toHtml() );
mage::d($optBlock->getOptionHtml($option));
//mage::ms($option);
//mage::d( (array) $option );
//foreach($option as $opt){
//}
//break;
}
die;
$associatedProducts = $p->getTypeInstance(true)->getAssociatedProducts($p);
//mage::d($associatedProducts);
$products_links = Mage::getModel('catalog/product_link_api');
try {
mage::d($products_links->assign("grouped", 4, 11));
} catch (Exception $e) {
mage::d($e);
}
mage::d($products_links->items("grouped", 4));
//mage::d($p->getData());
//mage::ms($p);
//echo $p->isSuper();
//echo $p->getTypeId()."\n";
//echo $p->setPriceType(1)."\n";
//echo $p->getPriceType()."\n";
//$p->setTypeId('grouped');
//$p->save();
//$p->setName('Dior BLACKTIE107 807 Black');