本文整理汇总了PHP中Varien_Object::setHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::setHtml方法的具体用法?PHP Varien_Object::setHtml怎么用?PHP Varien_Object::setHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::setHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
*
* @throws Exception
* @return Varien_Object
*/
public function process()
{
$cacheId = $this->_getCacheKey();
$response = $cacheId ? Mage::app()->loadCache($cacheId) : false;
if ($response) {
$response = unserialize($response);
}
if (!$response instanceof Varien_Object) {
$client = new Zend_Http_Client(self::API_URI, $this->_clientConfig);
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost($this->getParams());
$result = $client->request();
$data = Zend_Json::decode($result->getBody());
if ($data['status'] != 201) {
throw new Exception("Premailer failed to run: {$data['message']} #{$data['status']}");
}
$htmlClient = new Zend_Http_Client($data['documents']['html'], $this->_clientConfig);
$textClient = new Zend_Http_Client($data['documents']['txt'], $this->_clientConfig);
$response = new Varien_Object();
$response->setVersion($data['version']);
$response->setHtml($htmlClient->request()->getBody());
$response->setText($textClient->request()->getBody());
if ($cacheId) {
$data = Mage::app()->saveCache(serialize($response), $cacheId, array(self::CACHE_KEY), 60 * 60);
}
}
return $response;
}
示例2: addAfterToHtml
public function addAfterToHtml($html, Mage_Core_Block_Abstract $block)
{
$transportObject = new Varien_Object();
$transportObject->setHtml($html);
Mage::dispatchEvent('aitunits_core_block_template_to_html_after', array('block' => $block, 'transport' => $transportObject));
$html = $transportObject->getHtml();
return $html;
}
示例3: getGroupedHtml
public function getGroupedHtml()
{
$html = parent::getGroupedHtml();
$_transportObject = new Varien_Object();
$_transportObject->setHtml($html);
Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => $_transportObject));
$html = $_transportObject->getHtml();
return $html;
}
示例4: getPriceHtml
/**
* Returns product price block html
*
* @param Mage_Catalog_Model_Product $product
* @param boolean $displayMinimalPrice
*/
public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
{
$html = parent::getPriceHtml($product, $displayMinimalPrice, $idSuffix);
$container = new Varien_Object();
$container->setHtml($html);
Mage::dispatchEvent('block_catalog_product_get_price_html', array('block' => $this, 'container' => $container));
$html = $container->getHtml();
return $html;
}
示例5: getGroupedHtml
/**
* Retrieve messages in HTML format grouped by type
*
* @param string $type
* @return string
*/
public function getGroupedHtml()
{
$html = parent::getGroupedHtml();
/**
* Use single transport object instance for all blocks
*/
$_transportObject = new Varien_Object();
$_transportObject->setHtml($html);
Mage::dispatchEvent('core_block_messages_get_grouped_html_after', array('block' => $this, 'transport' => $_transportObject));
$html = $_transportObject->getHtml();
return $html;
}
示例6: testGoogleAnonymizationDisabled
/**
* @test
* @loadFixture testGoogleAnonymizationDisabled
*/
public function testGoogleAnonymizationDisabled()
{
$block = $this->app()->getLayout()->createBlock('googleanalytics/ga')->setTemplate('googleanalytics/ga.phtml');
$transport = new Varien_Object();
$transport->setHtml($block->toHtml());
$event = new Varien_Event();
$event->setData('block', $block);
$event->setData('transport', $transport);
$observer = new Varien_Event_Observer();
$observer->setEvent($event);
$this->_model->setGAAnonymizerCode($observer);
$this->assertNotContains('_anonymizeIp', $observer->getEvent()->getTransport()->getHtml());
}
示例7: _toHtml
/**
* Add content of template block below price html if defined in config
*
* @return string
*/
public function _toHtml()
{
$html = trim(parent::_toHtml());
if (empty($html) || !Mage::getStoreConfigFlag('catalog/price/display_block_below_price')) {
return $html;
}
if ($this->getTemplate() != $this->_tierPriceDefaultTemplate) {
$htmlObject = new Varien_Object();
$htmlObject->setParentHtml($html);
$htmlTemplate = $this->getLayout()->createBlock('core/template')->setTemplate('germansetup/price_info.phtml')->setFormattedTaxRate($this->getFormattedTaxRate())->setIsIncludingTax($this->isIncludingTax())->setIsIncludingShippingCosts($this->isIncludingShippingCosts())->setIsShowShippingLink($this->isShowShippingLink())->toHtml();
$htmlObject->setHtml($htmlTemplate);
Mage::dispatchEvent('germansetup_after_product_price', array('html_obj' => $htmlObject, 'block' => $this));
$html = $htmlObject->getPrefix();
$html .= $htmlObject->getParentHtml();
$html .= $htmlObject->getHtml();
$html .= $htmlObject->getSuffix();
}
return $html;
}
示例8: _toHtml
protected function _toHtml()
{
if (!Mage::getStoreConfig('jeroenvermeulen_solarium/results/autocomplete_product_suggestions')) {
return parent::_toHtml();
}
$productIds = $this->getSuggestProductIds();
if (empty($productIds)) {
return parent::_toHtml();
} else {
// Magento by default starts with a hidden <li>, don't know why.
$html = '<ul class="product_suggest"><li style="display: none"></li>';
$transport = new Varien_Object();
$transport->setHtml(null);
// Event listener can fill this with HTML, <li> tags.
Mage::dispatchEvent('jeroenvermeulen_solarium_get_product_suggest_html', array('product_ids' => $productIds, 'transport' => $transport));
if (!is_null($transport->getHtml())) {
$html .= $transport->getHtml();
} else {
$productCollection = $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('entity_id', array('in' => $productIds))->addAttributeToSelect(array('name', 'thumbnail', 'product_url'));
$counter = 0;
foreach ($productCollection as $product) {
$rowClass = ++$counter % 2 ? 'odd' : 'even';
$imageUrl = Mage::helper('catalog/image')->init($product, 'thumbnail')->resize('50');
$showName = Mage::helper('core/string')->truncate($product->getName(), 100);
$html .= sprintf('<li title="%s" class="%s" data-url="%s">', htmlentities($product->getName()), $rowClass, htmlentities($product->getProductUrl()));
$html .= '<span class="suggestions-productimage">';
$html .= sprintf('<img src="%s" />', htmlentities($imageUrl));
$html .= '</span>';
$html .= '<span class="suggestions-productname">';
$html .= htmlentities($showName);
$html .= '</span>';
$html .= '</li>';
}
}
$html .= '</ul>';
}
return $html;
}
示例9: getPdfBundleItemRow
/**
* render the html for 1 bundled sales object item line <tr>$trInner</tr>
*
* @param $pdfItem
* @param $subItems
* @param $vertSpacing
* @param bool $styleOverride
* @param int $position
*
* @return string
* @access public
*/
public function getPdfBundleItemRow($pdfItem, $subItems, $vertSpacing, $styleOverride = false, $position = 1)
{
$columns = $this->getPdfColumnHeaders();
if ($columns) {
//check if the subitems of the bundle have separate prices
$subItemsSum = 0;
foreach ($subItems as $bundleItem) {
$subItemsSum += $bundleItem['price'];
}
//don't display bundle price if subitems have prices
if ($subItemsSum > 0) {
$html = Mage::app()->getLayout()->createBlock('pdfcustomiser/pdf_item')->setPdfHelper($this)->setPdfItem($pdfItem)->setSubItems($subItems)->setVertSpacing($vertSpacing)->setStyleOverride($styleOverride)->setPosition($position)->setTemplate('fooman/pdfcustomiser/bundle-with-subitems.phtml')->toHtml();
} else {
$pdfItem['productDetails']['Subitems'] = array();
foreach ($subItems as $bundleItem) {
$bundleItem['Name'] = $bundleItem['productDetails']['Name'];
//keep BC
$pdfItem['productDetails']['Subitems'][] = $bundleItem;
}
$html = $this->getPdfItemRow($pdfItem, $vertSpacing, $styleOverride, $position);
}
}
$transport = new Varien_Object();
$transport->setHtml($html);
Mage::dispatchEvent('fooman_pdfcustomiser_pdf_item_row_bundle', array('item' => $pdfItem, 'subitems' => $subItems, 'transport' => $transport));
return $transport->getHtml();
}
示例10: markContentViaTransport
/**
* Mark content via the event transport mechanism. Magento 1.4.1+
*
* @param $containerArgs array
* @param $transport Varien_Object
* @return void
*/
public function markContentViaTransport($containerArgs, Varien_Object $transport)
{
$transport->setHtml("<!-- BRIM_FPC {$containerArgs['name']} {$this->registerBlockUpdateData($containerArgs)} -->\n" . $transport->getHtml() . "\n" . "<!-- /BRIM_FPC {$containerArgs['name']} -->");
}
示例11: toHtml
/**
* Produce and return block's html output
*
* It is a final method, but you can override _toHtml() method in descendants if needed.
*
* @return string
*/
public final function toHtml()
{
Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
return '';
}
/* START: Added by Cm_Diehard */
// if setBlockIsDynamic and setSuppressOutput then we automatically render only a placeholder tag.
if ($this->getBlockIsDynamic() && Mage::registry('diehard_lifetime')) {
if ($this->getSuppressOutput()) {
return '<div id="' . substr($this->getDiehardSelector(), 1) . '"></div>';
} else {
if (FALSE) {
return '<!-- DIEHARD_BLOCK|' . $this->getDiehardSelector() . '|' . json_encode($this->getCacheKeyInfo()) . ' -->';
}
}
}
/* END: Added by Cm_Diehard */
$html = $this->_loadCache();
if ($html === false) {
$translate = Mage::getSingleton('core/translate');
/** @var $translate Mage_Core_Model_Translate */
if ($this->hasData('translate_inline')) {
$translate->setTranslateInline($this->getData('translate_inline'));
}
$this->_beforeToHtml();
$html = $this->_toHtml();
$this->_saveCache($html);
if ($this->hasData('translate_inline')) {
$translate->setTranslateInline(true);
}
}
$html = $this->_afterToHtml($html);
/**
* Check framing options
*/
if ($this->_frameOpenTag) {
$html = '<' . $this->_frameOpenTag . '>' . $html . '<' . $this->_frameCloseTag . '>';
}
/**
* Use single transport object instance for all blocks
*/
if (self::$_transportObject === null) {
self::$_transportObject = new Varien_Object();
}
self::$_transportObject->setHtml($html);
Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => self::$_transportObject));
$html = self::$_transportObject->getHtml();
return $html;
}
示例12: _afterToHtml
/**
* Processing block html after rendering
*
* @param string $html
* @return string
*/
protected function _afterToHtml($html)
{
$html = parent::_afterToHtml($html);
$transport = new Varien_Object();
$transport->setHtml($html);
Mage::dispatchEvent('checkout_block_cart_sidebar_aftertohtml', array('block' => $this, 'transport' => $transport));
return $transport->getHtml();
}
示例13: templateHtmlAction
public function templateHtmlAction()
{
$response = new Varien_Object();
$response->setError(false);
$templateId = $this->getRequest()->getParam('template');
/* @var $template Mzax_Emarketing_Model_Template */
$template = Mage::getModel('mzax_emarketing/template')->load($templateId);
$response->setHtml($template->getBody());
$this->getResponse()->setHeader('Content-Type', 'application/json')->setBody($response->toJson());
}
示例14: testShowWarningForOpenInvoicePayments
public function testShowWarningForOpenInvoicePayments()
{
$transport = new Varien_Object();
$transport->setHtml('Foo');
$observer = Mage::getModel('ops/observer');
$event = new Varien_Event_Observer();
$event->setBlock('');
$observer->appendPartialCaptureWarningForOpenInvoice($event);
$this->assertEquals('Foo', $transport->getHtml());
$order = new Varien_Object();
$payment = new Varien_Object();
$methodInstance = Mage::getModel('ops/payment_openInvoiceNl');
$payment->setMethodInstance($methodInstance);
$order->setPayment($payment);
$invoice = $this->getModelMock('sales/order_invoice', array('getOrder'));
$invoice->expects($this->any())->method('getOrder')->will($this->returnValue($order));
Mage::register('current_invoice', $invoice);
$block = Mage::app()->getLayout()->getBlockSingleton('adminhtml/sales_order_invoice_totals');
$blockMock = $this->getBlockMock('ops/adminhtml_sales_order_invoice_warning_openInvoice', array('renderView'));
$blockMock->expects($this->once())->method('renderView')->will($this->returnValue('<b>warning</b>'));
$this->replaceByMock('block', 'ops/adminhtml_sales_order_invoice_warning_openInvoice', $blockMock);
$event->setBlock($block);
$event->setTransport($transport);
$observer->appendPartialCaptureWarningForOpenInvoice($event);
$this->assertEquals('Foo<b>warning</b>', $transport->getHtml());
$this->assertNotEquals('Bar<span>warning</span>', $transport->getHtml());
Mage::unregister('current_invoice');
}
示例15: testAppendParcelAnnouncementValidationToShipping
public function testAppendParcelAnnouncementValidationToShipping()
{
$sessionMock = $this->getModelMockBuilder('checkout/session')->disableOriginalConstructor()->setMethods(null)->getMock();
$this->replaceByMock('singleton', 'checkout/session', $sessionMock);
$sessionMock = $this->getModelMockBuilder('customer/session')->disableOriginalConstructor()->setMethods(null)->getMock();
$this->replaceByMock('singleton', 'customer/session', $sessionMock);
$intrashipConfigMock = $this->getModelMock('intraship/config', array('isEnabled'));
$intrashipConfigMock->expects($this->any())->method('isEnabled')->will($this->returnValue(true));
$this->replaceByMock('model', 'intraship/config', $intrashipConfigMock);
$this->store = Mage::app()->getStore(0)->load(0);
$this->store->setConfig('intraship/dhlaccount/active', true);
$transport = new Varien_Object();
$transport->setHtml('Foo');
$observer = Mage::getModel('dhlaccount/observer');
$event = new Varien_Object();
$block = Mage::app()->getLayout()->getBlockSingleton('checkout/onepage_shipping');
$blockMock = $this->getBlockMock('dhlaccount/checkout_onepage_parcelannouncement', array('renderView'));
$blockMock->expects($this->once())->method('renderView')->will($this->returnValue('<b>Foo</b>'));
$this->replaceByMock('block', 'dhlaccount/checkout_onepage_parcelannouncement', $blockMock);
$event->setBlock($block);
$event->setTransport($transport);
$observer->appendParcelAnnouncementValidationToShipping($event);
$this->assertEquals('Foo<b>Foo</b>', $transport->getHtml());
$this->assertNotEquals('<b>Foo</b>', $transport->getHtml());
}