本文整理汇总了PHP中Varien_Object::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::setName方法的具体用法?PHP Varien_Object::setName怎么用?PHP Varien_Object::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCustomerByPost
public function getCustomerByPost($params)
{
$customer = $this->_getCustomer();
// Patch for custom Contact Us form with ability to change email or name of customer (HDMX-98)
if ($customer->getId() > 0 && !isset($params['customer_email']) && !isset($params['customer_name'])) {
return $customer;
}
$email = $params['customer_email'];
$name = $params['customer_name'];
$customers = Mage::getModel('customer/customer')->getCollection();
$customers->addAttributeToSelect('*')->addAttributeToFilter('email', $email);
if ($customers->count() > 0) {
return $customers->getFirstItem();
}
$c = Mage::getModel('customer/customer');
$c->getEmail();
$c->setEmail('aaa');
/** @var Mage_Customer_Model_Customer $address */
$address = $customers->getFirstItem();
if ($address->getId()) {
$customer = new Varien_Object();
$customer->setName($address->getName());
$customer->setEmail($address->getEmail());
$customer->setQuoteAddressId($address->getId());
return $customer;
}
$customer = new Varien_Object();
$customer->setName($name);
$customer->setEmail($email);
return $customer;
}
示例2: _createRowObject
/**
* Converts map array to microdata Object
*
* @param array $map map array returned by the generator
* @return null|Varien_Object
*/
protected function _createRowObject($map)
{
if (empty($map['price']) || empty($map['availability']) || empty($map['title'])) {
return null;
}
$microdata = new Varien_Object();
$microdata->setName($map['title']);
$microdata->setId($map['id']);
if (!empty($map['sale_price'])) {
$price = $map['sale_price'];
} else {
$price = $map['price'];
}
$microdata->setPrice(Zend_Locale_Format::toNumber($price, array('precision' => 2, 'number_format' => '#0.00')));
$microdata->setCurrency(Mage::app()->getStore()->getCurrentCurrencyCode());
if ($map['availability'] == 'in stock') {
$microdata->setAvailability('http://schema.org/InStock');
} else {
$microdata->setAvailability('http://schema.org/OutOfStock');
}
if (array_key_exists('condition', $map)) {
if (strcasecmp('new', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/NewCondition');
} else {
if (strcasecmp('used', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/UsedCondition');
} else {
if (strcasecmp('refurbished', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/RefurbishedCondition');
}
}
}
}
return $microdata;
}
示例3: saveAction
public function saveAction()
{
if ($data = $this->getRequest()->getPost()) {
// $id = $this->getRequest()->getParam('id');
$model = Mage::getModel('askit/askIt');
//update exist
if (!empty($data['id'])) {
$model->setData($data);
$id = (int) $data['id'];
$model->setId($id);
} else {
//new question create
$model->setText(strip_tags($data['text']))->setProductId((int) $data['product_id'])->setHint((int) $data['hint'])->setParentId(null)->setStoreId($data['store_id'])->setEmail($data['email'])->setStatus((int) $data['status'])->setCreatedTime($data['created_time']);
$customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToFilter(array(array('attribute' => 'email', 'like' => $data['email'])))->getFirstItem();
if ($customer) {
$model->setCustomerName($customer->getName())->setCustomerId($customer->getId());
}
$model->save();
$id = (int) $model->getId();
}
try {
if ($model->getCreatedTime() == NULL || $model->getUpdateTime() == NULL) {
$model->setCreatedTime(now())->setUpdateTime(now());
} else {
$model->setUpdateTime(now());
}
$model->save();
//add new answer
if (!empty($data['new_answer_text'])) {
$newAnswer = Mage::getModel('askit/askIt');
$adminUser = Mage::getSingleton('admin/session')->getUser();
$newAnswer->setParentId($id)->setStatus(2)->setStoreId($data['store_id'])->setText($data['new_answer_text'])->setProductId($data['product_id'])->setHint(0)->setCustomerName($adminUser->getFirstname() . ' ' . $adminUser->getLastname())->setEmail($adminUser->getEmail())->setCreatedTime(now())->setUpdateTime(now())->save();
if (Mage::getStoreConfig('askit/email/enableCustomerNotification')) {
$emailData = new Varien_Object();
$question = Mage::getModel('askit/askIt')->load($id);
$product = Mage::getSingleton('catalog/product')->load($newAnswer->getProductId());
$storeId = $question->getStoreId();
$emailData->setName($question->getCustomerName())->setProduct($product->getName())->setProductLink($product->getUrlModel()->getUrl($product, array('_store' => $storeId)))->setText($model->getText())->setAnswer($newAnswer->getText())->setAdminUserEmail($adminUser->getEmail())->setCustomerEmail($question->getEmail())->setStoreId($storeId);
$this->_sendCustomerNotification($emailData);
}
}
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('askit')->__('Item was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('askit')->__('Unable to find item to save'));
$this->_redirect('*/*/');
}
示例4: extractRefundLine
public function extractRefundLine($order, $amount)
{
$_extract = new Varien_Object();
$_extract->setName('Refund / Correction');
$_extract->setPrice($amount);
$_extract->setTaxAmount(0);
$_extract->setQtyOrdered(1);
return $_extract;
}
示例5: getWizardSteps
/**
* Get array of wizard steps
*
* array($inndex => Varien_Object )
*
* @return array
*/
public function getWizardSteps()
{
$steps = array();
foreach ((array) $this->getNode(self::XML_PATH_WIZARD_STEPS) as $stepName => $step) {
$stepObject = new Varien_Object((array) $step);
$stepObject->setName($stepName);
$steps[] = $stepObject;
}
return $steps;
}
示例6: _getWsdlConfig
/**
* Get wsdl config
*
* @return Varien_Object
*/
protected function _getWsdlConfig()
{
$wsdlConfig = new Varien_Object();
$queryParams = $this->getController()->getRequest()->getQuery();
if (isset($queryParams['wsdl'])) {
unset($queryParams['wsdl']);
}
$wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query' => $queryParams))));
$wsdlConfig->setName('Magento');
$wsdlConfig->setHandler($this->getHandler());
return $wsdlConfig;
}
示例7: getCustomer
/**
* Returns founded customer or preset entity
* @return Mage_Customer_Model_Customer | Varien_Object
*/
public function getCustomer(AW_Helpdeskultimate_Model_Proto $proto)
{
if ($customer = $this->_findCustomer($this->getFromEmail($proto))) {
// Found existing customer
return $customer;
} else {
// No customer found
$customer = new Varien_Object();
$customer->setName($proto->getFrom())->setEmail($this->getFromEmail($proto));
return $customer;
}
}
示例8: _prepareProduct
protected function _prepareProduct(array $productRow)
{
$product = new Varien_Object();
$product->setId($productRow[$this->getIdFieldName()]);
$id = $product->getId();
$productMedia = Mage::getModel('catalog/product')->load($id)->getImage();
$product->setMedia($productMedia);
$productName = Mage::getModel('catalog/product')->load($id)->getName();
$product->setName($productName);
$productUrl = !empty($productRow['url']) ? $productRow['url'] : 'catalog/product/view/id/' . $product->getId();
$product->setUrl($productUrl);
return $product;
}
示例9: last_reply_byTest
/**
* @test
* @loadFixture data
*
* @doNotIndex catalog_product_price
*/
public function last_reply_byTest()
{
$ticket = Mage::getModel('helpdesk/ticket')->load(2);
$rule = Mage::getModel('helpdesk/rule')->load(2);
$rule->setConditionsSerialized($this->getConditions('last_reply_by', '==', 'customer'));
$rule->afterLoad();
$this->assertFalse($rule->validate($ticket));
$customer = new Varien_Object();
$customer->setName('John Doe');
$customer->setEmail('john@example.com');
$ticket->addMessage('message 1', $customer, false, true);
$this->assertTrue($rule->validate($ticket));
}
示例10: addMessageUnknownCustomerTest
/**
* @test
* @loadFixture data
*
* @doNotIndex catalog_product_price
*/
public function addMessageUnknownCustomerTest()
{
$customer = new Varien_Object();
$customer->setName('John Doe');
$customer->setEmail('john@example.com');
$this->_model->addMessage('message 1', $customer, false, true);
$message = Mage::getModel('helpdesk/message')->getCollection()->getLastItem();
$this->assertEquals('message 1', $message->getBody());
$this->assertEquals(2, $message->getTicketId());
$this->assertEquals(Mirasvit_Helpdesk_Model_Config::MESSAGE_PUBLIC, $message->getType());
$this->assertEquals('John Doe', $message->getCustomerName());
$this->assertEquals('john@example.com', $message->getCustomerEmail());
$this->assertEquals('John Doe', $this->_model->getLastReplyName());
}
示例11: _getActions
/**
* Retrieve actions collection
*
* @return array
* @throws Exception
*/
protected function _getActions()
{
$config = Mage::getSingleton('smile_magecache/config');
$actionsConfig = $config->getActionConfig();
$items = array();
$i = 0;
foreach ($actionsConfig as $code => $actionConfig) {
$action = new Varien_Object();
$action->setPosition($i++);
$action->setCode($actionConfig->getCode());
$action->setName($actionConfig->getModel()->getLabel());
$action->setDescription($actionConfig->getModel()->getDescription());
$items[] = $action;
}
return $items;
}
示例12: __construct
/**
* initialize
*
* @access public
* @author Ultimate Module Creator
*/
public function __construct()
{
$customerSession = Mage::getSingleton('customer/session');
parent::__construct();
$data = Mage::getSingleton('customer/session')->getPopupCommentFormData(true);
$data = new Varien_Object($data);
// add logged in customer name as nickname
if (!$data->getName()) {
$customer = $customerSession->getCustomer();
if ($customer && $customer->getId()) {
$data->setName($customer->getFirstname());
$data->setEmail($customer->getEmail());
}
}
$this->setAllowWriteCommentFlag($customerSession->isLoggedIn() || Mage::getStoreConfigFlag('iou_ultimatepopup/popup/allow_guest_comment'));
if (!$this->getAllowWriteCommentFlag()) {
$this->setLoginLink(Mage::getUrl('customer/account/login/', array(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME => Mage::helper('core')->urlEncode(Mage::getUrl('*/*/*', array('_current' => true)) . '#comment-form'))));
}
$this->setCommentData($data);
}
示例13: _prepareCollection
protected function _prepareCollection()
{
/** @var $connector Smile_DigitalOceanManager_Model_Connector*/
$connector = Mage::getModel('digitaloceanmanager/connector');
$droplets = $connector->getDropletList();
$collection = new Varien_Data_Collection();
foreach ($droplets as $droplet) {
$obj = new Varien_Object();
$obj->setId($droplet->id);
$obj->setName($droplet->name);
$obj->setVcpus($droplet->vcpus);
$obj->setMemory($droplet->memory);
$obj->setDisk($droplet->disk);
$obj->setStatus($droplet->status);
$obj->setRegion($droplet->region->name);
$collection->addItem($obj);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例14: collectionsAction
public function collectionsAction()
{
$thing_1 = new Varien_Object();
$thing_1->setName('david');
$thing_1->setAge('27');
$thing_1->setLastName('Smith');
$thing_2 = new Varien_Object();
$thing_2->setName('Jane');
$thing_2->setAge(12);
$thing_3 = new Varien_Object();
$thing_3->setName('Spot');
$thing_3->setLastName('The Dog');
$thing_3->setAge(7);
//var_dump($thing_3->getData());
//var_dump($thing_3["last_name"]);
/*Definiremos ahora una serie de collections*/
$collection_of_things = new Varien_Data_Collection();
$collection_of_things->addItem($thing_1)->addItem($thing_2)->addItem($thing_3);
foreach ($collection_of_things as $thing) {
var_dump($thing->getData());
}
echo "<br><br>";
echo "obteniendo el primer y último elemento";
echo "<br><br>";
var_dump($collection_of_things->getFirstItem());
var_dump($collection_of_things->getLastItem()->getData());
echo "<br><br>";
echo "Ahora como xml";
var_dump($collection_of_things->toXml());
echo '<br><br>';
echo 'ahora obtenemos solo las columnas identificadas como name';
echo '<br><br>';
var_dump($collection_of_things->getColumnValues('name'));
echo '<br><br>';
echo 'El equipo de Magento nos permite realizar filtrados, ejemplo para el nombre david';
echo '<br/><br>';
var_dump($collection_of_things->getItemsByColumnValue('name', 'Spot'));
}
示例15: getCustomerInfoFromOrder
public function getCustomerInfoFromOrder($order)
{
$billingAddress = $order->getBillingAddress();
$address = new Varien_Object();
$address->setStreet($billingAddress->getStreet(1));
$address->setStreetNumber($billingAddress->getStreet(2));
$address->setComplementary($billingAddress->getStreet(3));
// optional
$address->setNeighborhood($billingAddress->getStreet(4));
$address->setZipcode(Zend_Filter::filterStatic($billingAddress->getPostcode(), 'Digits'));
$customer = new Varien_Object();
$customer->setName($order->getCustomerName());
$customer->setDocumentNumber($order->getCustomerTaxvat());
$customer->setEmail($order->getCustomerEmail());
$customer->setPhone($this->splitTelephone($billingAddress->getTelephone()));
$customer->setSex($this->formatGender($order->getCustomerGender()));
// optional
$customer->setBornAt($this->formatDob($order->getCustomerDob()));
// optional
$customer->setAddress($address);
Mage::dispatchEvent('pagarme_get_customer_info_from_order_after', array('order' => $order, 'customer_info' => $customer));
return $customer;
}