magento

Programmatically get the width and height of a product image in Magento?

眉间皱痕 提交于 2020-01-24 15:29:27
问题 Inside Magento templating code I want to get the width and height of the original product image (uploaded by admin when creating product), so as to make according adjustments. How can I do this? Thus far I have: $this->helper('catalog/image')->init($_product, 'image') Does this have any methods that would allow me to retrieve the original dimensions of the product image? Such as: $this->helper('catalog/image')->init($_product, 'image')->getWidth() Or something? Thanks! 回答1: Just found it in

how to display recently viewed products list on product details page - magento

余生颓废 提交于 2020-01-24 12:49:09
问题 I have used mobileshoppe theme for magento and trying to display recently viewed product list at product details page but some how its not working... Added code below at catalog.xml <catalog_product_view translate="label"> <reference name="content"> <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/> </reference> </catalog_product_view> and below code at app\design\frontend\default\mobileshoppe\template

How to use custom customer variables in transactional email templates in magento?

半城伤御伤魂 提交于 2020-01-24 12:42:11
问题 I have added some custom variables to customer and I want to use them in email template. Here's example how I have added a variable to customer in my installer: $setup->addAttribute('customer', 'companyname', array( 'input' => 'text', 'type' => 'varchar', 'label' => 'Company name', 'visible' => 1, 'required' => 1, 'user_defined' => 1, )); $setup->addAttributeToGroup( $entityTypeId, $attributeSetId, $attributeGroupId, 'companyname', '999' //sort_order ); $oAttribute = Mage::getSingleton('eav

How to use custom customer variables in transactional email templates in magento?

谁都会走 提交于 2020-01-24 12:41:08
问题 I have added some custom variables to customer and I want to use them in email template. Here's example how I have added a variable to customer in my installer: $setup->addAttribute('customer', 'companyname', array( 'input' => 'text', 'type' => 'varchar', 'label' => 'Company name', 'visible' => 1, 'required' => 1, 'user_defined' => 1, )); $setup->addAttributeToGroup( $entityTypeId, $attributeSetId, $attributeGroupId, 'companyname', '999' //sort_order ); $oAttribute = Mage::getSingleton('eav

Redirect all HTTP urls to HTTPS for frontend in magento

こ雲淡風輕ζ 提交于 2020-01-24 01:09:08
问题 I want to redirect all http urls to https in magento, but for front-endonly. In magento we have a setting to use secure urls for front-end as explained in this link: https://www.siteground.com/tutorials/magento/magento_ssl.htm but that applies to only pages shown after login or checkout. I have applied following code in my .htaccess file: RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] It is working ok, but it is redirecting Admin panel urls to https as well. I

How to implement magento cache hole punching for shopping cart block

≯℡__Kan透↙ 提交于 2020-01-23 14:00:10
问题 Im using Magento EE version 1.12 with Full page cache enabled a) my product detail page is cached b) as a result my shopping cart in this page doesn't show dynamic item count c) so i am not able to show valid cart item count in my product detail page steps i followed 1) I created a block and called from header.phtml 2) trying to make that topcart.phtml block not to be cached As im a newbie in magento , i got some links for cache hole punching I followed below links but no success my file

How to implement magento cache hole punching for shopping cart block

可紊 提交于 2020-01-23 13:58:20
问题 Im using Magento EE version 1.12 with Full page cache enabled a) my product detail page is cached b) as a result my shopping cart in this page doesn't show dynamic item count c) so i am not able to show valid cart item count in my product detail page steps i followed 1) I created a block and called from header.phtml 2) trying to make that topcart.phtml block not to be cached As im a newbie in magento , i got some links for cache hole punching I followed below links but no success my file

Magento - display product reviews on product view page

喜你入骨 提交于 2020-01-23 10:55:57
问题 I am having difficulty placing the product reviews on the main product view at a specific location. I can load them in the content area, but not at the specific location I require (within some of the view mark-up). I have a local.xml with the following in it: <catalog_product_view> <reference name="content"> <block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/> </reference> <catalog_product_view> The above

Adding attributes to collection requests in Magento

故事扮演 提交于 2020-01-23 08:23:05
问题 I hope someone can help me puzzle this one out. I'm trying to load some data out of a Magento catalog model using a collection. The code looks like this: $model = Mage::getModel('catalog/product'); $collection = $model->getCollection(); $collection->addAttributeToSelect('short_description'); $collection->addFieldToFilter('SKU',array('like' => array('%EBOOK%'))); $collection->load(); var_dump($collection->getData()); This produces a dump of objects with all the fields in the flat catalog

Magento REST api authentication

房东的猫 提交于 2020-01-23 07:50:36
问题 Is there a way to pass login credentials from code instead of entering credentials everytime in the popup for login authorization? 回答1: You dont require login credentials every time for authorization,you'll get an access token and access secret upon successfull authorization by OAuth,use the later for further calls to the API.Oauth protocol works this way. I guess Magento is using OAuth 1.0/1.0a,so everytime you'll authorize a user you get, oauth_token - the Access Token that provides access