Questions tagged [programming]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
27
votes
4answers
3k views

Returning $this after observer

I see some conflicting information on the internet and in 3rd party modules alike - is it a requirement or best practice to return $this at the end of an observer method? E.g.: ...
21
votes
4answers
15k views

Get Config Value for Website Scope

How can I get a configuration value for a specific website? There is Mage::getStoreConfig() but no Mage::getWebsiteConfig(). edit: I am exporting configuration data on website level - so somehow I ...
17
votes
3answers
17k views

Importing orders from a CSV into Magento programmatically

We're switching from an old, outdated point-of-sale system to using Magento 1.7 as our POS exclusively. Not unexpectedly, one of the challenges we're facing is how to get almost 20 years of records ...
16
votes
3answers
15k views

How to Programmatically set a Product's Multi-Select Attribute by Labels

If have a multiselect attribute and want to set the selection on a product. $selectedOptions = "red,green,blue"; $product->..... // # what to do? How can I do that?
10
votes
1answer
2k views

“Gang of Four” Design Patterns in Magento Core

There are a few very obvious patterns in use in Magento's core, such as: Singleton Registry Event/Observer Factory Model/View/Controller But there are others that may be in use in Magento that I'm ...
8
votes
4answers
21k views

How do I get a website id from a store id?

Given a store id, how do I get the website id that matches that store?
7
votes
1answer
16k views

Magento + JQuery + Ajax - How do I reload just parts of my custom Module instead of the whole Block?

I was just recently given the task to create a simple Product configurator for our Magento Template in 5 days, where you can choose some attributes and it calculates the price for you, fades over a ...
5
votes
3answers
4k views

Get new empty item on model method

Collections provide a handy means of getting a blank model - e.g.: $quote->getItemsCollection()->getNewEmptyItem(); Is there any means of doing this from an existing model without having to ...
4
votes
2answers
2k views

What is good practise for getting resource/collection models?

Which one is more correct: Mage::getResourceModel() or Mage::getModel('catalog/product')->getCollection() I always use the first method unless I already have a model that I can call the ...
4
votes
1answer
4k views

Show tracking link for custom shipping method

We defined a custom shipping method by extending Mage_Shipping_Model_Carrier_Abstract. There is a method public function isTrackingAvailable() { return true; } But after we enter a tracking ...
4
votes
1answer
184 views

Can't find callbackFunction

I've been looking all over the place and I can't find what this is: updateCallback : function(elm, status) { if (typeof elm.callbackFunction != 'undefined') { eval(elm.callbackFunction+'(\...
4
votes
1answer
1k views

PayPal Ipn model and automatically order state changes

First of all i will explain you about the actuall functionality: Customer buys in shop via PayPal Shop operators call the order from an external software (WaWi; don't know in en) and the software ...
3
votes
3answers
9k views

How to remove the Breadcrumbs from the homepage

When Full Page Cache is on the breadcrumbs show up on the home page, i've tried changing the line <?php if($crumbs && is_array($crumbs)): ?> to <?php if($crumbs && is_array($...
3
votes
2answers
2k views

Advanced level learning for Magento [closed]

The main question would be, how do you people get advanced understating of core Magento? In particular there are a few subjects that preoccupy me the most: Cart/payment/checkout process. Quote/order ...
3
votes
3answers
1k views

Provide properties to views in Magento

In Zend Framework we provide properties to layouts which are then consumed in the view. An example of this would be: $this->layout = new Zend_Layout(); $this->layout->username = 'John'; $...
3
votes
2answers
2k views

getFinalPrice() on associated simple product returns base price not parent product special price

I have 2 products one is configurable and has a special price of 100 and the associated product has no special price assigned and Final Price is not being returned on the associated product. I am ...
3
votes
2answers
3k views

Cannot checkout error. Please agree to all the terms and conditions before placing the order

Hi we recently saw this error on Magento 1.9.0.1. And no idea why. And especially where to look on how to debug. T&C haas been enabled in backend. And 1 agreement was set (ID=1). It does not ...
3
votes
2answers
119 views

How i can clean cache programmatically for only one store?

How i can clean cache programmatically for only one store ? and refresh index for only one store ?
3
votes
1answer
109 views

How to enable interruptable downloads on downloadable products?

I have a downloadable product store. My problem is that some of my files range over 1GB which is quite often, too large to download in one sitting. I want my customers to be able to pause their ...
3
votes
2answers
3k views

Programmatically Set/Change Thumbnail Image To Another From Gallery

I have a huge catalog of products which all have about 4 images per product with the same naming structure being something like "xxxxxx_FR.jpg" "xxxxxx_BK.jpg" "xxxxxx_FL.jpg" where the x's represent ...
2
votes
1answer
212 views

Pass multiple variables to view

We can pass a variable to a .phtml view file like this: $currentTime = date("H:i", time()); $someValue = 123; $this->loadLayout(); $this->getLayout() ->getBlock('newsletter_popup') ...
2
votes
1answer
2k views

Class calling another class

I am new in PHP as well as in Magento. I have some questions regarding factory methods and fundamental of PHP of OOPS. As if we want to call a method in php we instating the class and we call a ...
2
votes
1answer
50 views

How to know all available methods and how to use them [closed]

I'm still learning how to use Magento and I see that it has lots of useful methods. However, my only way of learning that a method exists, and how to use it, remains looking at code that's already ...
2
votes
1answer
1k views

create bundle order programmatically

I have this code: http://pastebin.com/iFwyKM7G Inside an event-observer class which executes after the customer registered. It creates an order automatically and it works for simple products. ...
1
vote
1answer
735 views

How do you set Allow Countries directly in the database, programmatically or using n98-magerun?

I have a list of over 200 countries I need to allow for an EE 1.13 site. I'd prefer not to do this through the admin interface because it is tedious and I am error prone. Is it possible to set Allow ...
1
vote
1answer
185 views

Load with addWebsiteFilter not working

I am working on product collection. Here is my query: $_product = Mage::getModel('catalog/product')->addWebsiteFilter($allWebsiteIds)->load($productid); But this is not working. As reference ...
1
vote
1answer
4k views

Programmatically reordering

I'm trying to create a new order, based on an old order. $orig_order = Mage::getModel('sales/order')->load((int)$order_id); $order_model = Mage::getSingleton('adminhtml/sales_order_create')...
1
vote
1answer
13k views

How to filter product collection by attribute's admin option values?

I am currently developing a product configurator. I am submitting a form which sends the admin option values of my custom attributes via POST to a controller action. If I use the current store's ...
1
vote
2answers
8k views

Programmatically Converting Currency

I am trying to convert currency in Magento 1.5 using the following code in a separate file to check currency conversion. I have two stores with respective currency settings in the admin. ...
1
vote
2answers
413 views

How write a Magento 2 standard Model class

I have create database table and want to create model,resource,Collection class and know that how to create. Have follow the blog https://www.softprodigy.com/store/article/create-model-and-...
1
vote
2answers
41 views

Help writing an observer the “Magento Way”

Fairly new to objected oriented programming and very new to Magento programming, but trying to learn the "right way". I'm writing a before save observer to update product attributes based on other ...
1
vote
1answer
112 views

Find The Declaration of a Block

I've written a function that uses debug_backtrace() to find which methods were called in which PHP files to eventually load a given Block. (Look for the blockBacktrace method in the Helper class here.)...
1
vote
1answer
5k views

Convert attribute type from Text to Dropdown

How can I convert a product attribute type from Text to Select in the Magento Backend. Is there any in-built functionality or we need to write custom code for that? I already have attribute values ...
1
vote
1answer
213 views

Using variables in Category Title. Meta and descriptions - e.g. product count

is there an easy way to make certain variables available in the field for: category title, category description or category meta? Suppose we want to make our category title "{COUNT}+ Brand name ...
1
vote
1answer
31k views

Javascript - Can't get 'getElementsByClassName' working

Im struggling to figure out why my code is not working. Here is part of the JS: function init() { var showMenu = document.getElementsByClassName('showMenu'), perspectiveWrapper = document....
1
vote
1answer
66 views

Tab view on landingpage?

On the product lasting pages there is the tab view. Is it possible to create custom tabs on landingpages? A bit like this https://www.decalgirl.com/custom/cases - this is not my page, just like the ...
1
vote
1answer
1k views

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘e.Featured’ in ‘where clause’

HI All Respected Magento Devs, I was customizing my magento website after theme installation and i am not sure how it could happened but my site stopped working due to this below error. strangely my ...
1
vote
2answers
5k views

How to get pricing_value for Super Attribute Option

Somehow I can't figure out how to get the pricing values for a configurable product's super attribute options. Currently I have an array of attribute id and attribute option id which looks like this:...
1
vote
1answer
366 views

Design Strategy - Helper methods that throw Exceptions

I am implementing a plugin for a client that will use the 'Max Sale Quantity' value of a Magento Stock Item on a product as a means of setting an upper-bound on total customer purchases. Because I ...
1
vote
0answers
38 views

Magento2 - how to automatically create UpgradeData, UpgradeSchema based on existing table(s)

Who knows is there any tools, modules or whatever to convert existing table dump and structure into UpgradeData, UpgradeSchema? Why? For example you created complicated settings stored in DB and you ...
1
vote
1answer
139 views

wishlist not getting?

Hi i am using below code for wishlist but i not getting below result. $customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*'); $wishList = Mage::getModel('...
0
votes
1answer
1k views

How to only show cms block in phtml file on homepage

we need to show cms block in footer of homepage only our block is called footer_partners We tried both <?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()): ?> <div ...
0
votes
1answer
197 views

How to have “My Cart” in banner7.phtml? how to show everything same like in header My cart

i have installed magento 1.8.1 and i want to show My Cart right after banner section. i am placing the code in banner.phtml file and it seems working but problem is that it is not showing cart items ...
0
votes
3answers
8k views

Payment not saving in quote when creating order programmatically

I have a current script that uses a mishmash of pure Magento methods and the API. I'm trying to convert it all to straight Magento methods, but I'm having an issue to get the payment method to stay. ...
0
votes
1answer
2k views

How to get Discount Percent

I am looking for a way to get the discount percent of an order, possibly from the order class or the invoice class, it would be amazing if $order->getDiscountPercent(); worked, but it doesn't, ...
0
votes
1answer
28 views

Why magento not provide facility of add product for a store view

I am working on multi store functionality and stuck in a problem for managing products. My requirement is just around for store views products that's why sending this post. I just want to know, why ...
0
votes
1answer
645 views

addFieldToFilter doesn't return the right product for selected attribute values

I am currently programming a product configurator module for Magento. Everything is working fine so far besides the core functionality: choosing the right product from the database for the selected ...
0
votes
1answer
3k views

admin sales order total shipment empty

I recently have the problem that the yellow block with the total order on the bottom right of the sale order info page stays empty. I looked into the files and found out that in /app/design/adminhtml/...
0
votes
3answers
51 views

How to use for loop in PHTML page

How to use for loop in phtml page i want to use the for loop in phtml page to complete my functionality <php? for(i=1;1<=3;i++): //My code endfor: ?> I used as above code.
0
votes
1answer
29 views

Need Advice on Complex Customized Magento 2 Shop

Products: 900~ Specific Features: 55 to 60 3rd party Extensions required: 20 to 30 Customization required: Theme, Extension, default Magento logic Could you please advice me based on your experience. ...