- 浏览: 152044 次
- 性别:
- 来自: 上海
最新评论
-
kirenenko04:
我没要学.学你妈的Demandware,被老板娘逼的.我现在去 ...
Demandware Training -
itxinmeng:
不错,现在做demandware的不多哦,可以交流下下..
Demandware Training
文章列表
1. in upgrade script:
<?php
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
/**
* Add 'checkout_process' attribute for entities
*/
$entities = array(
'quote',
'order'
);
$options = array(
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
'visible' => tru ...
<global>
<events>
<sales_order_place_after>
<observers>
<sales_order_place_after_observer_change_status>
<type>singleton</type>
<class>mysales/observer</class>
...
I wanted to create orders in magento using a script. So i searched and found couple of scripts. And i thought of putting them together here. They had to be modified a little bit. For example on Magento 1.5 i got the below script working
<?php
/*
require_once 'app/Mage.php';
Mage::app();
...
#1 add attribute for entites in upgrade script:
<?php
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
/**
* Add 'checkout_process' attribute for entities
*/
$entities = array(
'quote_item',
'order_item'
);
$options = array(
'type' => Varien_Db_Ddl_Table::T ...
to search the video swf url from web.
and then use these phtml to show video image and url link
<div class="image-box">
<a class="fancybox image_gal" rel="iframeLink" href="<?php echo $item->getVideo();?>">
<img src=" ...
public function getDepartmentCollection() {
$store_id = Mage::app()->getStore()->getStoreId();
$collection = Mage::getModel('recruit/recruittype')->getCollection()
->addFieldToFilter('parent_id', 0)
->addFieldToFilter('store_id',
array(
...
<?php
$allStores = Mage::app()->getStores();
foreach ($allStores as $_eachStoreId => $val)
{
$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
$_storeId = Mage::app()->getStore($_eachStoreId)-& ...
1. rewrite in config.xml:
<config>
<helpers>
<mysales>
<class>Bysoft_Mysales_Helper</class>
</mysales>
</helpers>
<frontend>
<routers>
<mysales>
<use>sta ...
foreach ($order_items as $oi) {
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $oi->getSku());
$_product = Mage::getModel('catalog/product')->load($_product->getId());
if ($_product->getTypeId() == 'bundle') {
$options = $oi->getProductOptions(); ...
in xml:
<models>
<myreward>
<class>Bysoft_Myreward_Model</class>
</myreward>
<enterprise_reward>
<rewrite>
<action_orderExtra>Bysoft_Myreward_Model_Action_OrderExtra</action_orderExtra>
</rewrite>
</enterpris ...
the Requirement:
there is a visual service item in cart,
every time change relation product , the service item will be change qty
so add a Magento Observer model to approach it.
here is some content in the config.xml :
<global>
<helpers>
<mycheckout>
...
foreach ($_options as $_option) {
$option_type = $_option->getType();
if ($option_type == 'drop_down' || $option_type == 'checkbox') {
$values = $_option->getValues();
foreach ($values as $key=> $val) {
var_dump($val->getData());
}
} else {
var_dump($_o ...
<?php
class Bysoft_Import_Model_Crosssells extends Mage_Core_Model_Abstract {
protected $_store_id;
public function get_store_by_code($storeCode) {
$stores = array_keys(Mage::app()->getStores());
foreach($stores as $id){
$store = Mage::app()->getStore($id);
if($store-&g ...
$full_wishlist = $item->getBuyRequest()->toArray()
array_count_values() 函数
- 博客分类:
- php
array_count_values() 函数用于统计数组中所有值出现的次数。
本函数返回一个数组,其元素的键名是原数组的值,键值是该值在原数组中出现的次数。
<?php
$a=array("Cat","Dog","Horse","Dog");
print_r(array_count_values($a));
?>
输出:
Array ( [Cat] => 1 [Dog] => 2 [Horse] => 1 )