예제 #1
0
 public static function installOrderAttributes(Package $pkg)
 {
     //create custom attribute category for orders
     $oakc = AttributeKeyCategory::getByHandle('store_order');
     if (!is_object($oakc)) {
         $oakc = AttributeKeyCategory::add('store_order', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $oakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
         $orderCustSet = $oakc->addSet('order_customer', t('Store Customer Info'), $pkg);
     }
     $text = AttributeType::getByHandle('text');
     $address = AttributeType::getByHandle('address');
     Installer::installOrderAttribute('email', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('billing_first_name', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('billing_last_name', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('billing_address', $address, $pkg, $orderCustSet);
     Installer::installOrderAttribute('billing_phone', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('shipping_first_name', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('shipping_last_name', $text, $pkg, $orderCustSet);
     Installer::installOrderAttribute('shipping_address', $address, $pkg, $orderCustSet);
 }