Show the product tax class name
$taxClassId = $_product->getTaxClassId(); $taxClass = Mage::getModel('tax/class')->load($taxClassId); $taxClassName = $taxClass->getClassName();
Shop by brand, for example in the sidebar.
$product = Mage::getModel('catalog/product'); $attributes = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($product->getResource()->getTypeId())->addFieldToFilter('attribute_code', 'manufacturer'); $attribute = $attributes->getFirstItem()->setEntity($product->getResource()); $manufacturers = $attribute->getSource()->getAllOptions(false); ?>
How to upload files in magento
if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') { try { $uploader = new Varien_File_Uploader('logo'); $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png')); $uploader->setAllowRenameFiles(false); $uploader->setFilesDispersion(false); $path = Mage::getBaseDir('media') . DS; // $path = Mage::getBaseDir('media') . DS . 'logo' . DS; $logoName = $_FILES['logo']['name']; $uploader->save($path, $logoName); } catch (Exception $e) { } }
Hersteller anzeigen
echo $_product->getAttributeText('manufacturer');
How to check for https
if (!Mage::app()->getStore()->isCurrentlySecure()) { ... }
Sending transactional emails
$email = Mage::getModel('core/email_template'); $email->sendTransactional( 'some_email_template', // template array('name' => 'Your Company', 'email' => 'contact@yourcompany.com'), // sender details 'joe@joebloggs.com', // recipient email 'Joe Bloggs', // recipient name array('customerName' => 'Joe Bloggs'), // merge vars Mage::app()->getStore()->getStoreId() // store id );
Display store contact name and email
// General Contact $name = Mage::getStoreConfig('trans_email/ident_general/name'); $email = Mage::getStoreConfig('trans_email/ident_general/email'); // Sales Representative $name = Mage::getStoreConfig('trans_email/ident_sales/name'); $email = Mage::getStoreConfig('trans_email/ident_sales/email'); // Customer Support $name = Mage::getStoreConfig('trans_email/ident_support/name'); $email = Mage::getStoreConfig('trans_email/ident_support/email'); // Custom Email 1 $name = Mage::getStoreConfig('trans_email/ident_custom1/name'); $email = Mage::getStoreConfig('trans_email/ident_custom1/email'); // Custom Email 2 $name = Mage::getStoreConfig('trans_email/ident_custom2/name'); $email = Mage::getStoreConfig('trans_email/ident_custom2/email');