Magento update with csv and unset special price - magento

I'm trying to update a product in Magento through Import/Export -> Import, using a .csv file. I'm passing just _sku, _type, _attribute_set, _store, price and special_price columns. I want to unset the current special price of the product, but when I pass an empty string it sets the special price to 0. I tried with null, "NULL" and "<NULL>" but the result is the same. When the value is 0 it is still shown as special price on the front end, which is really confusing. That's why I want to set it to null, as this is the value it receives when it's being removed from the admin.
My goal is the equivalent of this:
$product = Mage::getModel('catalog/product')->load(some_id);
$product->setSpecialPrice('');
$product->save();
Any ideas?

I just realized that setting the special price a value that is equal to the value of the regular price will do the job. Then the template for the special price will not be used on the front end. I hope it will not bring some other issues, but for now it works for me.

You cant remove it with a regular csv import. Your best bet would be to add coloumn;
special_to_date
and set a date in the past in this format;
31/10/2014 00:00
This will expire your special price.

Related

Number filed is not processed correctly

I use Oracle Apex, I want that my 'display only field' is updated automatically. Well, when I use dynamic actions like this select 5 * price from ... or, for instance, random values, it works absolutely correctly, the field is filled with the value 5 * price (or set new random value). But when I use select :P4_COUNT * price from, the filed is empty. I think that the problem in :P4_COUNT (it is a number field) but I do not know what to do.
In the Dynamic Action, look for "Items to Submit" (usually under the SQL or PL/SQL code). Put the names of items that need to be submitted to session state prior to running the code. Also, note that currently, all values in session state are strings. So it's probably best to use to_number if you need a number.

Laravel problem with relation leading zero

I have come across problems with Laravel relations when couple of model ids are identical but another has leading zero and the another has not.
Product ID | Productname
-----------|------------
012345 | Product A
12345 | Product B
If those relations are loaded in the same query, only the first one will be returned and the other will not.
The database columns are strings and in the Product model I have been set the incrementing to false and cast of id attribute to string. Doesn't Laravel's eager loading take leading zeros into account?
I'm not able to change those product ids with leading zeros.
Thanks in advance!
I just run a test on a local laravel installation and I can't reproduce the problem.
Are you sure it is not a problem of the way you structure a query? Because if at any time during your program the $id variable is treated as an integer, the future conversion to string will remove the leading zero.
For example, maybe you get the id from the request:
$productId = $request->get('product_id');
At this point $productId is considered an integer, so if you use productId to query your DB, the leading zero will be removed.
You need to be sure that during the lifecycle of your request that variable is never converted to integer.
You can test the proper query using tinker, and obtaining your products manually:
Product::find('012345');
Product::find('12345');

MS Access Custom Formatting: Currency in K

I am trying to create an appropriate Format table property of a specific MS Access table in order to achieve the display style described below. For example purposes, let the table name be example and the field that I am trying to format be dollars
When example!dollars.Value is 567.98, I wish to display $0.567K. I also wish to display 1,000.42 as $1.000K.
In another table storing larger values, I use the Format property string $#,##0,\K; ($#,##0,"K)"[Red];"| < $1K |"; --, which successfully displays the amount in K dollars; however, any values less than $1K cannot be displayed. This is not acceptable due to the scale of the values in the example table.
The most intuitive solution is to use the string $0,000\K and specify the thousands separator as . instead of ,. However, I do not know how to do this.
Any advice will be greatly appreciated!
This works for me:
Kamount = Format(Amount/1000, "$0.000K")
So divide by 1000, then format as needed.
Use the Format property string $0\.000\K

adding date range to custom attribute magento

Is there any way to add a date range to a custom attribute (similar to that used for special prices and the "new" status of product) in magento? For example, I have a custom flag which tracks the status of a product. It would make it a lot easier if I could use a date range to set/unset that field.
(For example, when a product is marked as "coming soon" I add a tag to its image, which I manually unset once I make the product "new". Annoying to have to do it manually)
You will have to create 2 attributes that hold 2 dates. Them being:
New From: (Date Value)
New To: (Date Value)
Then, you will have to go into the file where you want the attribute to display, check to see if the date is within the range of today's date.

Magento quick search by SKU

When I try to search products by SKU, I get incomplete results. For example: I have products with SKU IR-CP-CH_1 and A-453-B-I_1. Both products are configurable products, both are visible for Catalog, Search. I get correct result for query IR-CP-CH_1 and no result for A-453-B-I_1.
Indexes are rebuilt. I use combined search type (like + fulltext). In advanced search everything works fine.
I suggest you take a quick look in your database at the table catalogsearch_fulltext. In the data_index column you should be able to see the SKUs as part of the full text string Magento creates for quick searching in.
See if you can either manually spot the elusive SKU 'A-453-B-I_1' or hit it with an
SELECT * FROM catalogsearch_fulltext WHERE data_index LIKE '%453%'
Maybe the SKU got entered with some strange characters or a space instead of a hyphen. You could search in the product_id column instead to see what search string Magento does have for that SKU.
If the string is in the table and the character glyphs match exactly, then I think you are looking to indexing, caching, stock, store views etc as suggested in the comments above by others
If the string is not in the table at all then I think you are looking to 'visibility'.
If you look in the table catalogsearch_query and find your search string 'A-453-B-I_1' then look to the num_results column - if that value is greater than zero then items were found but it's not displaying that product for some reason.
**EDIT following comments below
Actually I think you should remove that '0' result from the catalogsearch_query table. You could remove it using SQL or phpmyadmin. Magento will return a result from catalogsearch_query if it finds one rather that search catalogsearch_fulltext every time.
It is possible that at some point the result was '0' but now it is non-zero but Magento is stuck with the '0 results' in the catalogsearch_query table.
There is more analysis that can be done, but try that first and if it still isn't right we can look at trapping the database query to try to understand why Magento thinks the result is zero.
For information, in my case, a free module (activo_catalogsearch) was breaking the research by sku because it was not up to date and probably conflicting with magento 1.9.4.1 (worked fine before with magento 1.9.2.1)

Resources