- 浏览: 152320 次
- 性别:
- 来自: 上海
最新评论
-
kirenenko04:
我没要学.学你妈的Demandware,被老板娘逼的.我现在去 ...
Demandware Training -
itxinmeng:
不错,现在做demandware的不多哦,可以交流下下..
Demandware Training
文章列表
验证字符串是否由数字和密码组成的正则表达式
- 博客分类:
- php
if (!preg_match("/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/",$password)) {
$errors[] = Mage::helper('customer')->__('Password must composed of numbers and letters');
}
1 . create a collection.php to get data
<?php
class Bysoft_Mycatalog_Block_Apparel_Collection extends Mage_Core_Block_Template
{
public function __construct()
{
parent::__construct();
$collection = Mage::getModel('catalog/product')->getCollection();
$this->setCollection ...
public function isUnderApparel($cate_id, $parent_id) {
$collection = Mage::getModel('catalog/category')->getCollection()
->addAttributeToFilter('entity_id', array('eq' => $parent_id)); // 服装分类的ID
foreach ($collection as $c) {
$parent = $c;
break;
}
$sub_cateids = arr ...
in Block File:
<?php
class Bysoft_Mypage_Block_Manufacturer extends Mage_Core_Block_Template {
public function getAllBrands($cate_id, $first='') {
$is_test = true;//display all brands ignore category
$manu_content = array();
if ($is_test ===false) {
// filter by c ...
1. Fist, Add a shipped status in backend
2.rewrite Mage_Adminhtml_Sales_Order_ShipmentController
<config>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Bysoft_Mysa ...
overwrite Mage_Sales_Model_Quote_Address
<?xml version="1.0"?>
<config>
<modules>
<Empire_Sales>
<version>1.0.0.0.0</version>
</Empire_Sales>
</modules>
<global>
<models> ...
$attrs = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
$attributeArr = array();
foreach($attrs as $attr) {
$attributeArr[$attr['attribute_code']] = array();
foreach ($attr['values'] as $at) {
$attributeArr[$attr['attribute_code']][] = array('label'=> ...
You can keep any currency code instead of basecurrency.
/**
* Get the base currency
*/
$baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
/**
* Get all allowed currencies
* returns array of allowed currency codes
*/
$allowedCurrencies = Mage::getModel('directory/currenc ...
PayPal Error: Unable to process payment. Please contact the merchant as the shipping address provided by the merchant is invalid, and the merchant has requested that your order must be shipped to that address.
in Magento 1.8
we can rewrite this class:
<?php
class Bysoft_MyPaypal_Model_P ...
<?php
$installer = $this;
$installer->startSetup();
try {
$table = $installer->getTable('awrma/entity');
$conn = $installer->getConnection();
$conn->addColumn($table, 'authorize_code', "varchar(100) default NULL AFTER `tracking_code`");
$conn->commit();
} cat ...
//tire price
$tierPrices[] = array(
'website_id' => 0,
'cust_group' => 32000,
'price_qty' => $row['qty_1'],
'price' => $row['price_1']
);
//Second defined tier price
$tierPrices[] = array(
'website_id' => 0,
'cust ...
public function attributeValueExists($arg_attribute, $arg_value)
{
$attribute_model = Mage::getModel('eav/entity_attribute');
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
$attribute_code = $attribute_model->getIdByCode('catalog_prod ...
//for example:
// I will add a attribute group named 'Vendor' to 'Default' attribute set
function addAttributeGroup($group_name, $attrSetName,$sort_order) {
$modelGroup = Mage::getModel('eav/entity_attribute_group');
$attributeSetId = Mage::getModel('eav/entity_attribute_set')
->load($att ...
alter table [TABLE NAME] convert to character set utf8 collate utf8_unicode_ci;
通过路径:http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
可以获取到这样的结果:
{
"results" : [
{
"address_components" : [
{
"long_name" : "1600",
...