Ina Code Blog

bunch of code in one place
Dec
17

Magento: add to cart button is not working

Posted by admin in Magento

In buy prescription drugs without prescription my custom theme there was this code for Add to cart button:

<button type=”button” class=”button-form” onclick=”productAddToCartForm.submit()”><span><?php echo $this->__(’Add to Cart’) ?></span></button>

The problem was that nothing happened when you clicked it. buying generic cialis Just remove type="button" so it looks like this:

<button class=”button-form” onclick=”productAddToCartForm.submit()”><span><?php echo $this->__(’Add to Cart’) ?></span></button>

It worked for me…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Dec
14

Magento: error when opening product view page

Posted by admin in Magento

When I try to open product view page I get this error:

Warning: include(/…../…../public_html/magento/app/design/frontend/mytheme/default/template/page/2columns-left) [function.include]: failed to open stream: No such file Buy cialis ejaculation Viagra or directory in /…../…../public_html/magento/app/code/core/Mage/Core/Block/Template.php on line 144

The problem occured because I made a mistake in /app/design/frontend/mytheme/mytheme/layout/catalog.xml. In <catalog_product_view> tags I have set:

<action method=”setTemplate”><template>page/2columns-left</template></action>

where it must be:

<action method=”setTemplate”><template>page/2columns-left.phtml</template></action>

!!!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Dec
10

Magento: how to set number of columns in product list

Posted by admin in Magento

Open /app/design/frontend/your_theme/your_theme/template/catalog/product/list.phtml and find line:

<?php $_columnCount = $this->getColumnCount(); ?>

and replace it with:

<?php $_columnCount = 4; ?>

Set the number of columns buy buy cialis brand drugs online as you need.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Dec
4

Magento: set number of products in new products module

Posted by admin in Magento

You can set number Viagra Online of products to be displayed in new product module in your new.phtml file. Find:

<?php $i=0; foreach ($_products->getItems() as $_product): ?>

and add above, so the code looks like this:

<?$_products->setOrder(’news_from_date’)->setPageSize(6)->setCurPage(1);?>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>

Set the number (6) as you like.

On the other hand you can set this number in administration on home cms page. Under Custom desing set the code for new products to look like this:

<reference name=”content”>
<block type=”catalog/product_new” name=”home.new” alias=”product_new” template=”catalog/product/new.phtml”>
<action method=”setProductsCount”><count>8</count></action>
<action method=”addPriceBlockType”>
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</block>
</reference>

Just cialis mg dosage set the number in tags.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Jun
10

Magento: How to move cart block from sidebar to header?

Posted by admin in Magento

Open file: /app/design/frontend/your_theme/your_theme/template/page/html/header.phtml and add this line where you want the cart block to be displayed:

<?php echo $this->getChildHtml(’cart_sidebar_head’) ?>

Open file: /app/design/frontend/your_theme/your_theme/layout/page.xml and insert this in block type page/html_header:

<block type=”checkout/cart_sidebar” name=”cart_sidebar_head” template=”checkout/cart/sidebar.phtml” buy prescription drugs />

You probably don’t need cart block in you sidebar anymore so open file: /app/design/frontend/your_theme/your_theme/layout/checkout.xml and remove or comment these lines:

<block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml” before=”-”>
<action method=”addItemRender”><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method=”addItemRender”><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method=”addItemRender”><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
</block>

best cialis

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Jun
3

Magento: how to display a certain attribute?

Posted by admin in Magento

Here is how you can display certain attribute on product page. In my case I needed to display cost price:

prescription drugs without prescription cialis generic best price <?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getCost()), ‘cost’) ?>

Or use this for your custom attributes:

<?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getCustom()), ‘Custom’) ?>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Apr
20

Magento: remove break (br) tag from textarea

Posted by admin in Magento

After installing WYSIWYG editor to my magento site the <br /> tags were still added after each row in textareas. My main problem was the product description so I opened file /app/design/frontend/my_theme/my_theme/template/catalog/product/view/description.phtml and found line:

<?php echo $this->helper(’catalog/output’)->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), ‘description’) cialis 40 mg ?>

and replaced it with:

<?php echo $this->helper(’catalog/output’)->productAttribute($this->getProduct(), Cialis Online buy $this->getProduct()->getDescription(), ‘description’) ?>

Basically I removed the nl2br() function which inserts the <br /> tags to the description text. You can do the same where ever the breaks are messing up your design view…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Apr
10

Magento: how to change image resolution?

Posted by admin in Magento

Magento resizes and sets image resolution to 75 by default. It was a big problem for me so I had to change that.

To reset image resize resolution open file /lib/Varien/Image/Adapter/Gd2.php prescription drugs without a prescription and find (line 80):

call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName);

and replace it with:

if (IMAGETYPE_JPEG === $this->_fileType)call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName,100);
else
call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName);

For this change to take the effect you need to reset your cache. In your cialis how it works administration go to System -> Cache Management and Clear Image Cache and Refresh All Cache!

Note: Currently I’m using Magento v.1.3.0.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Feb
27

Magetno problem: dbModel read resource does not implement Zend_Db_Adapter_Abstract

Posted by admin in Magento

I recived CSRF Attack Prevention message from Magento team saying that Magento admin has an vulnerability if attacker knows the admin path. Probably like most people I also used /admin/ to access the Magento administration. The message adviced to change it to something specific, so I did. And the page just crashed!?!

I got the error:

dbModel read resource does not implement Zend_Db_Adapter_Abstract
Trace:
#0 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php(68): Varien_Data_Collection_Db->setConnection(false)
#1 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/Config.php(789): cialis generic vs brand Mage_Core_Model_Mysql4_Collection_Abstract->__construct(Object(Mage_Core_Model_Mysql4_Website))
#2 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/Config.php(831): Mage_Core_Model_Config->getModelInstance(’core_mysql4/web…’, Object(Mage_Core_Model_Mysql4_Website))
#3 /home/chasi/public_html/trgovina/app/Mage.php(345): Mage_Core_Model_Config->getResourceModelInstance(’core/website_co…’, Object(Mage_Core_Model_Mysql4_Website))
#4 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/Abstract.php(200): Mage::getResourceModel(’core/website_co…’, Object(Mage_Core_Model_Mysql4_Website))
#5 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/Abstract.php(205): Mage_Core_Model_Abstract->getResourceCollection()
#6 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/App.php(384): Mage_Core_Model_Abstract->getCollection()
#7 /home/chasi/public_html/trgovina/app/code/core/Mage/Core/Model/App.php(247): drugs without prescription Mage_Core_Model_App->_initStores()
#8 /home/chasi/public_html/trgovina/app/Mage.php(432): Mage_Core_Model_App->init(”, ’store’, Array)
#9 /home/chasi/public_html/trgovina/app/Mage.php(453): Mage::app(”, ’store’, Array)
#10 /home/chasi/public_html/trgovina/index.php(52): Mage::run()
#11 {main}

I searched and searcher the forums and Magento pages and got some ideas on what may solve the problem. I had to contact my server provider and ask them to delete all cache (/var/cache/) and session (/var/session/) files. I couldn’t do it myself as my permission wasn’t sufficient. If that still doesn’t solve the problem ask them to restart the Apache aswell. That worked for me and the Magento shop is back and runing :)

The other solution would be to reinstall Magento. Hmmmm…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Feb
24

Magento speed problem

Posted by admin in Magento

Modifying, I mean uncommenting few lines in your .htaccess file can speed up your magento site a looooot. Find these lines below and just remove # before them.

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some online cialis more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch Buy Generic Drugs Without Prescription \bMSIE !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary

# enable resulting html compression
php_flag zlib.output_compression on

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]