magento , Magento And- OR query

Magento And- OR query


Tag: magento

We are having two attributes check_in_stock and show_in_front. I would like to have magento equivalent query for : where (check_in_stock > 0 OR (check_in_stock=0 and show_in_front=1)).

Please help me to find the equivalent magento query


Well you can use the SQL queries like:

Mage::getModel("catalog/product")->getCollection()->getSelect()->where('check_in_stock > 0 OR (check_in_stock=0 and show_in_front=1)')

This wil lcreate an sql output like:

"SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (check_in_stock > 0 OR (check_in_stock=0 and show_in_front=1))"


Magento: how to add a static block AFTER product list

In a web site my boss wants me to insert a static block AFTER the product list of that category. Up to now, using the Magento front end application, the one you can see here, I have seen that I can add a static block only before the product list....

Get variables always in differnet .phtml templates

I have to use some variables again and again in different files. $_product = $this->getProduct(); $_helper = $this->helper('catalog/output'); $_productType = $_product->getTypeID(); $_productName = $_helper->productAttribute($_product, $_product->getName(), 'name'); $_manufacturer = $_product->getAttributeText('manufacturer'); $_decor = $_product->getAttributeText('decor'); $_serie = $_product->getAttributeText('serie'); $originalImageWidth = $this->helper('catalog/image')->init($_product,...

Run Magento Dataflow Import Profile Programmatically

I've tried to get this working, but it can't seem to find a solution. I'm looking to run an existing dataflow profile which has an ID = 3, and has the import file name already configured. All the research I've done, leads to some variation of the following code: public...

Redirect in CheckOut

I currently work on a magento payment module which has to check if certain fields in a users profile/account are set. If they do not exist/have no content, I want to either 1. redirect to /customer/account/edit/ 2. display a notice that the fields in question has to be filled or...

multi site not showing the header/nav on one site [closed]

so i have a multi site setup and everything seemed to run fine until the other day when one of the sites decided to not show the header/nav here are the two sites: and i think this happened after i combined JS/css but all my other sites are...

Magento Show 'plus shipping costs' on product view page next to price

I want to show the plain text "plus shipping costs" next to the price on my product view page. I don't want the taxes% to be shown, but only the shipping text as a link to my shipping costs information. I couldnt find the file or admin setting yet....

Magento simplexml_load_string() error location

I have a really annoying problem. I was doing some alterations to Magento shop when I ran into simplexml_load_string() error, it is clear to me that this error is caused by some bad XML file, but the very important question to me is which file and where is it located?...

Magento admin panel not working in chrome [duplicate]

This question already has an answer here: Why I can not login to magento backend using google chrome 9 answers I installed latest version of magneto in my Localhost but when i opened this on my server, the admin panel not redirect in chrome but on Firefox it works...

Category banner in a magento website

I have moved the category banner into 2column.left.phtml. How can I do to display it on the category pages only and not on the product pages ? For example my category page is "cuff-links" and when I click on a product on this category page the link changes to "cufflinks/sliver-star",...

Replace Product Names with a Loop

I have a Magento webshop with several products in it. All of them begin with the word PRODUCT, for example PRODUCT 001. I want to replace the word "PRODUCT" with "Article". I tried to write a small script, but it's not working at all. Here is what I've got so...

Magento setShippingMethod('freeshipping_freeshipping') observer event

I need to display the shipping notice in cart. In order to display the notice I've set the shipping method using php in an observer: $quote = Mage::getModel('checkout/cart')->getQuote(); $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setCountryId('DE')->setShippingMethod('freeshipping_freeshipping')->save(); The event I used is "add_to_cart_before": <add_to_cart_before> <observers> <add_to_cart_before> <class>dispatcher/observer</class>...

Magento - how to translate message type

How do I translate the message type that is displayed to the user when adding product to cart? The message itself is translated, but the message heading, "Success" is not. So for the French version of my site, the message is: "Success! Glacière Nomad Extreme 55 L a été ajouté...

Magento: Add dynamic code to head section in specific CMS Page

I'm trying for a while now to get some code into the head section of our custom 'contacts' CMS page. The plan is to make this page to a configurable popup window through a backend setting (true/false). So far I managed to rewrite the app/code/core/Mage/Page/Block/Html/Head.php. The problem is that any...

'Select' 2 pieces of info (XSLT file)

I am trying to link our Magento website with Sage 50 with a piece of software. We would like the customers first name and last name to go into the company field. Below are the 3 lines I assume I have to tweak: <Forename><xsl:value-of select="billing_address/firstname"/></Forename> <Surname><xsl:value-of select="billing_address/lastname"/></Surname> <Company><xsl:value-of select="billing_address/company"/></Company> How...

Magento custome option product in search result

I am uploading an product and product has different size available, Now if customer- who want to buy this, they have to select size then after they can buy. How to do this. I knew custom option is available in magento. But i want to allow customer to search product...

Magento add a column to sales_flat_quote table and add data

I am coming from a previous enviornment where doing things like modifying queries and adding columns was just a matter of writing the sql and executing it. However, now that I'm working in Magento I want to do things "the Magento way". Scenario: we use paypal express, and before the...

Magento - How to create different weight-price drop down in products

How can I build a drop down list with different weights with prices for a product, which can be selected by user. Something like this Example When user selects his required weight from the drop down the price also changes....

Custom Tabs does not show up in catalog product information

I'm trying to add a custom tab in catalog, I'm following FishPig's tutorial. So I want to achieve something like this I have followed every instructions in the tutorial but still can't get it right. I have disabled the catching and enabled debugging. I have checked the logs but I...

Get custom attribute of products from observer order object Magento

I am trying to get a custom attribute in from a product in an observer. I have the following: public function export_new_order($observer){ $orderIds = $observer->getData('order_ids'); foreach($orderIds as $_orderId){ $order = Mage::getModel('sales/order')->load($_orderId); Mage::log($order->debug()); } } Which works fine, I get a nice print_r in my log. However, when I try to...

Add percentage discount for individual product in magento

I need to give percentage discount for my simple products in magento and I need to show the discount amount in the front end also. I had googled to find a solution but I could not find any. I tried to use shipping cart rules, but I need to give...

Why has overriding password hashing caused urls to break in magento admin?

I have overriden the hash($data) and validateHash($password, $hash) of Mage_Core_Model_Encryption in a custom module. It works I can login to the admin area with my password and it validates correctly with the new hash; however, I cannot navigate in the admin area. I see a password-like hash becomes part of...

Add block to all CMS Pages with certain URL Key

I'm trying to discover whether this is possible or not. We have a series of CMS pages that represent our library. So the URL keys for these pages are something like: library/ library/top-ten library/five-questions library/faq etc... The powers that be want to add a static block that will appear only...

Arabic words in invoice pdf print Magento

I'm trying to fix this problem by using integration TCPDF in magento but i don't know how do that this is my try in this file \app\code\core\Mage\Sales\Model\Order\Pdf\Abstract.php require_once('TCPDF/TCPDF.php'); $pdf = new TCPDF_TCPDF (PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true,'UTF-8', false); I don't know waht i'm doing wrong. thank you....

How to add elements to a fieldset in magento horizontally rather than vertically

I am adding few check boxes in to magento using the fieldset option like the following. $fieldset = $form->addFieldset('display', array( 'legend' => $helper->__('Schedule Sales Order Transfer'), 'class' => 'fieldset-wide' )); for($i=01; $i*5<60; $i++){ $time = $i*5; $fieldset->addField('min'.$time, 'checkbox', array( 'name' => 'Checkbox', 'checked' => false, 'onclick' => self::setAll("min"), 'onchange' =>...

Magento custom module Observer not working

I have created my custom module in magento at app/code/local/mycustom/GeoLocation, in that i want to create a observer so i had followed lot of tutorials and at last i had created below code to call it on every page load of magento but still it is not calling my observer.php...

SQL Table Error Magento

This is very odd, anyone have an answer for why this gives an error? ------------------------------------------------------ -- -- -- Table structure for table `mg_cataloginventory_stock` -- CREATE TABLE IF NOT EXISTS `mg_cataloginventory_stock` ( `stock_id` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Stock Id', `stock_name` VARCHAR( 255 ) DEFAULT NULL COMMENT 'Stock...

How to customize the left side-bar in Magento 1.9 category view

I am trying to customize my left side-bar in Magento when the frontend shows a certain category. For example I want to remove the Newsletter box and a custom block which was added by the theme developer. However I am not able to find the correct file to edit in...

Magento: Is a certain product in the cart?

On my list.phtml page, I want my PHP script to be able to tell whether any product is in the cart, based on it's SKU. So my conditional would theoretically be like this: $_sku = 123; if($_sku->isInBasket() == true){ echo 'Product: ' . $_sku . ' is in the cart';...

How to create custom adminhtml theme magento

I try to extends default adminhtml magento theme. So I create a file in: app/design/adminhtml/default/myTheme And also create a new module, I know that my module load because it appear in the modules lists in System->Configuration->Advanced and in my config.xml (of this module) I write: <?xml version="1.0" encoding="UTF-8"?> <config>...

Magento module not calling install script, to create attribute for category

I am creating module in magento 1.9.1, to create a attribute for categories. I have created files as follows: app\etc\modules\Ddevs_Ebayaff.xml <?xml version="1.0"?> <config> <modules> <Ddevs_Ebayaff> <active>true</active> <codePool>local</codePool> </Ddevs_Ebayaff> </modules> </config> I am trying to call controller and mysql install script in one config file as follows app\code\local\Ddevs\Ebayaff\etc\config.xml <?xml version="1.0"?> <config>...

I am facing issues in radios validation in magento

i have added the radios field in magento but i have problem in validation it show the all radios are required, and when i select an option it gave me error for other options. here is my code: <?php $fieldset->addField('size', 'radios', array( 'label' => Mage::helper('moduelname')->__('Maximum rim size you can handle...

Css text/image wrap not working

Why does the text wrap not work around these images? I work in magento text editor, that why i do not use a css style sheet but write it into the code. Not working version: i used TextWrap I worked for me in many other situations like here:

Magento custom extension isn't called in CMS page

I create an extension on Magento, but when I include it into a CMS page, it isn't called. There is no error or warning. I tried to put debug line in the extension, but those lines aren't displayed too. So I think that it's a configuration issue. Here is my...

Create order sales_email_order_items html file

I am creating order from backend in magento and user is getting email of order details, in that email product details are coming from variable sales_email_order_items. I want to modify that table(totals of order tax, subtotal etc.). I have tried changing in file app/design/adminhtml/default/default/template/email/order/items.phtml but it do not shows any...

Always shows order status pending in Magento working in my localhost

when i had tried to order a item in magento in my localhost, to shows order status is pending. Even I gave sample visa card account information. How the order status works. how i can change order status in pending to processing. I had checked these in my localhost then...

Get Order Details by Order Id

I need to retrieve an order from Magento by its id. How do I load a specific order by id?

How to add custom tab to CMS selection in magento admin menu

Please help me. I have my module - Feedback. I want to add tab to CMS selection in magento admin menu, that would be like this CMS->Feedback. In this tab I want show grid of received messages....

Magento: Object not found in localhost

I'm trying to copy website made in Magento in my localhost and finished another steps: downloaded whole website via ftp account, import database from server, change parameters for database in local.xml (post root for user and empty field for password), clear cache in Magento var folder, change base_url value in...

Magento backend 404 error due to disabling default store view

I have a working magento installation with 2 websites 2 stores and 2 views the first one being default other i created just for some testing (which giving 404 error for some reason). So it happened that while i was fiddling with magento's 'manage store' feature i accidental disabled the...

Unable to add product to cart programmatically in Magento

I have tried every possible technique to add product with quantity to cart ( in Magento), following are the things I have tried and forums/sites taken help from. But none of them is working. I am using Magento Community edition If anyone has any suggestion/answer, please share. Tried to...

how to increase number of product on homepage in magento

i am new in magento and reading a file toolbar.phtml and file path is E:\wamp\www\meditrust_mage\app\design\frontend\default\medi\template\catalog\product\list\toolbar.phtml...... in this file i found this peace of code,and dont know where to change product limit on homepage.i want to show all products on homepage and want to increse dropdown value to differnt level like...

Magento Ignore Child Attributes in Layered Navigation

I have some bundled products that have attributes associated with them. The child products also have the same attributes associated with them, however they are sometimes different. My issue is that with layered navigation, it is looking at both the bundled product and all the child products' attributes. I was...

Perform Some Action after Customer successful Login : Magento

I am creating a module in which I want to check some condition after customer successfully login, if condition is true then customer login otherwise not. I know two ways of doing this : Overriding AccountController With Magento event. My query are: which is the best way? Is there any...

how to add slideshow in magento front-end

Hello everyone i want to add slideshow on page, i refereed below this url. I follwed all the given steps by Selva, but doesn't worked out for me. i followed steps upto 2 but didn't understand 3-step. My side first it was taking default website name, then i changed it...

Third party helper override doesn't work

I am writing an extension for Magento 1.7 where I need to override a helper from an third party extension. The name of my extension is Mkpreis_Ebay Name of the third party extension: Ess_M2ePro Helper I want to override: Ess_M2ePro_Helper_Module_Renderer_Description My config.xml <config> <modules> <Mkpreis_Ebay> <version>0.0.1</version> </Mkpreis_Ebay> </modules> <global> <helpers>...

magento redirect particular category and its subcategory to homepage

I have one category in magento shop called shop online. I want to redirect this category and its sub category to the home page using the htaceess. Tried this in htaccess to redirect RedirectMatch 301 ^/shop-online/$ can anyone please help me......

update local.xml with script in magento

I want to update my local.xml with script. I want to change my username , database name and password in the xml using my custom script. I am creating script. it can show the values of the node and also update the values but it can't set CDATA with the...

Get Product Options for each Product in the Catalog in Magento

This is using Magento 1.9. I am trying to build a script that outputs all the product options for each product in the catalog into a CSV file. I have tried using the code on this page: For this code: $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); foreach ($attribute->getSource()->getAllOptions(true) as $option) {...

Unable to convert Magento object array response to json format

I am trying to convert a magento object array to json, but it is giving the result {}. $facetColor = Mage::getModel('facets/color')->getCollection(); printing the array gives me print "<pre>"; print_r($facetColor); gamer_Facets_Model_Resource_Color_Collection Object ( [_joinedFields:protected] => Array ( ) [_model:protected] => facets/color [_resourceModel:protected] => facets/color [_resource:protected] => Gamer_Facets_Model_Resource_Color Object ( [_resources:protected] =>...

Check if radio button value is, then echo some HTML

I want to check if the value of the select field is some value and if it is, it needs to echo some text. I use this code for input box in the form: <li> <div class="input-box"> <strong><?php echo $this->__('Would you recommend this product to a friend?') ?></strong> <?php foreach...