本文整理汇总了PHP中ActiveRecordModel::loadEav方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::loadEav方法的具体用法?PHP ActiveRecordModel::loadEav怎么用?PHP ActiveRecordModel::loadEav使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecordModel
的用法示例。
在下文中一共展示了ActiveRecordModel::loadEav方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
if ($this->isInitialized) {
return;
}
$this->isInitialized = true;
if ($this->config->get('CHECKOUT_METHOD') == 'CHECKOUT_MULTISTEP') {
return new ActionRedirectResponse('checkout', 'index');
}
$this->isTosRequired = $this->config->get('REQUIRE_TOS');
parent::init();
$this->config->setRuntime('CHECKOUT_CUSTOM_FIELDS', self::CUSTOM_FIELDS_STEP);
$this->config->setRuntime('ENABLE_CHECKOUTDELIVERYSTEP', true);
$this->config->setRuntime('DISABLE_CHECKOUT_ADDRESS_STEP', false);
$this->config->setRuntime('DISABLE_GUEST_CHECKOUT', false);
$this->config->setRuntime('ENABLE_SHIPPING_ESTIMATE', false);
$this->config->setRuntime('SKIP_SHIPPING', false);
$this->config->setRuntime('SKIP_PAYMENT', false);
$this->config->setRuntime('REG_EMAIL_CONFIRM', false);
$this->config->setRuntime('EMAIL_NEW_USER', false);
$this->config->setRuntime('REQUIRE_TOS', false);
$this->loadLanguageFile('Order');
$this->loadLanguageFile('User');
$this->order->loadSpecification();
ActiveRecordModel::loadEav();
if ($this->user->isAnonymous()) {
if ($this->session->get('checkoutUser')) {
$checkoutUser = unserialize($this->session->get('checkoutUser'));
$checkoutUser->setID(null);
SessionUser::setUser($checkoutUser);
if ($this->user !== $checkoutUser && $checkoutUser instanceof User) {
$this->user = $checkoutUser;
}
}
$this->user->grantAccess('login');
$this->setAnonAddresses();
$this->order->user->set($this->user);
$this->order->shippingAddress->resetModifiedStatus();
$this->order->billingAddress->resetModifiedStatus();
$this->order->user->resetModifiedStatus();
} else {
$this->user->load();
$this->user->loadAddresses();
$address = $this->user->defaultShippingAddress->get();
if (!$address) {
$address = $this->user->defaultBillingAddress->get();
}
if (!$this->order->shippingAddress->get() && $address && $this->isShippingRequired($this->order)) {
$userAddress = $address->userAddress->get();
$this->order->shippingAddress->set($userAddress);
$this->order->save();
}
$address = $this->user->defaultBillingAddress->get();
if (!$this->order->billingAddress->get() && $address) {
$userAddress = $address->userAddress->get();
$this->order->billingAddress->set($userAddress);
$this->order->save();
}
}
}
示例2: processDataArray
protected function processDataArray($dataArray, $displayedColumns)
{
// load specification data
if ($this->isEav()) {
foreach ($displayedColumns as $column => $type) {
if (!strpos($column, '.')) {
continue;
}
list($class, $field) = explode('.', $column, 2);
if ('eavField' == $class) {
ActiveRecordModel::addArrayToEavQueue($this->getClassName(), $dataArray);
ActiveRecordModel::loadEav();
break;
}
}
}
return $dataArray;
}
示例3: postProcessResponse
protected function postProcessResponse(Response $response, Controller $controllerInstance)
{
if (!$response instanceof Renderable || !$this->isInstalled()) {
return false;
}
$response->set('user', $controllerInstance->getUser()->toArray());
$response->set('message', $controllerInstance->getMessage());
$response->set('errorMessage', $controllerInstance->getErrorMessage());
if ($controllerInstance instanceof FrontendController) {
$response->set('currency', $controllerInstance->getRequestCurrency());
}
// fetch queued EAV data
if (class_exists('ActiveRecordModel', false)) {
ActiveRecordModel::loadEav();
}
$renderer = $this->getRenderer();
if ($response instanceof ActionResponse && !$controllerInstance->isBlocksProcessed) {
$controllerInstance->isBlocksProcessed = true;
foreach ($renderer->getBlockConfiguration() as $object => $commands) {
foreach ($commands as $command) {
if ($renderer->isBlock($object)) {
$action = $command['action'];
switch ($action['command']) {
case 'replace':
$action['command'] = 'append';
$controllerInstance->removeBlock($object);
case 'append':
case 'prepend':
if (!empty($action['isDefinedBlock'])) {
$action = array_merge($action, (array) array_shift($controllerInstance->getBlocks($action['view'])));
}
$controllerInstance->addBlock($object, $action['call'], $action['view'], $action['command'] == 'prepend');
break;
case 'remove':
$controllerInstance->removeBlock($object);
break;
case 'theme':
$this->setTheme($action['view']);
break;
}
}
}
}
}
}
示例4: testEavQueue
public function testEavQueue()
{
// set up Manufacturer records
$field = EavField::getNewInstance('Manufacturer', EavField::DATATYPE_TEXT, EavField::TYPE_TEXT_SIMPLE);
$field->save();
$data = array('first', 'second', 'third');
foreach ($data as $value) {
$manufacturer = Manufacturer::getNewInstance($value);
$manufacturer->getSpecification()->setAttributeValueByLang($field, 'en', $value . ' test');
$manufacturer->save();
}
ActiveRecordModel::clearPool();
// fetch them from database
$manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', new ARSelectFilter());
foreach ($manufacturers as &$entry) {
ActiveRecordModel::addToEavQueue('Manufacturer', $entry);
}
// duplicate
$manufacturers = array_merge($manufacturers, $manufacturers);
// load EAV data
ActiveRecordModel::loadEav();
foreach ($manufacturers as $man) {
$this->assertEqual($man['name'] . ' test', $man['attributes'][$field->getID()]['value_en']);
}
}