Fatal error: Call to a member function setFinalPrice() on a non-object? - magento

When i installed an extension named ajax pro on magento 1.702. when i add a product to cart,it shows
Fatal error: Call to a member function setFinalPrice() on a non-object in ..app\code\core\Mage\Sales\Model\Quote\Item\Abstract.php on line 73.
although i delete all this extension's files and folders. when i add a product to cart. the error still exist? how to correct it. thank you. i have clear all the cache.

I got this error after programmatically creating a quote with a different store id to the default store id.
Fix was to run this sql (after backing up all sales_flat_quote tables, of course):
DELETE FROM sales_flat_quote_item;
Note that TRUNCATE sales_flat_quote_item won't work due to referential integrity, and that the above command will remove the linked records from some of the other sales_flat_quote tables as well.
In reply to the comment - if you don't have access to the database then ask your hosting provider to give it to you (most give you some sort of access - eg phpmyadmin) you can run it as a code snippet, I guess:
<?php
// Save this in Magento root directory.
require_once( dirname(__FILE__) . ' /app/Mage.php');
umask(0);
Mage::app()->setCurrentStore(0);
$resource = Mage::getSingleton('core/resource');
$dbw = $resource->getConnection('core_write');
$query = "DELETE FROM sales_flat_quote_item;";
$dbw->query($query);
It's not a good idea to run that on a live production system - existing customers will lose all the items in their carts - though if your site is broken and you've nothing left to lose, maybe give it a go!
To backup the database without access to it, https://www.phpmyadmin.net/ or a similar tool will help there. You can also run the above query directly using that.

Delete session files from var/session thats it.

If it is throwing for all the customers then you can delete sales_flat_quote_item table. If this happens only for particular customer then do the following thing. In this case, all the quotes wont be deleted.
Get the customer id from sales_flat_quote_address(column name: customer_id) table. Here you can get the specific quote id(column name in table is quote_id) which is causing the problem.
Example: SELECT quote_id FROM sales_flat_quote_address where customer_id=23423
Now, go to sales_flat_quote_item then delete the particular records which is causing the problem.
Example: DELETE FROM sales_flat_quote_item WHERE quote_id=43535

Related

Magento enterprise CMS request_url not updating

Using Magento 1.14.2
I am not sure if anyone had this issue before but when I update a URL key in Magento Enterprise CMS the changes are not taking effect in the tree.
Example: When test page's URL key is updated from test to test-1, I can still access http://test.com/someparent/test.html. Tried loading http://test.com/someparent/test-1.html and it comes up as 404 page not found.
My investigation so far:
When URL key is updated identifier field in cms_page is updated but not in enterprise_cms_hierachy_node (request_url key).
Went a bit further to look at the code and found that in app/core/Enterprise/Cms/Model/Hierarchy/Node appendPageToNodes()
if ($node->getPageExists()) {
continue;
} else {
$node->addData($pageData)
->setParentNodeId($node->getId())
->unsetData($this->getIdFieldName())
->setLevel($node->getLevel() + 1)
->setSortOrder($sortOrder)
->setRequestUrl($node->getRequestUrl() . '/' . $page->getIdentifier())
->setXpath($node->getXpath() . '/')
->save();
}
So, if page node exists it does nothing and moves on. Where as if doesnt exist it inserts new record.
Just wanted to know if any others have experienced this issue and what did you do to resolve the issue?
Follow the steps below, You will knock it off.
Take a backup of your database in .sql file using mysqldump command
Truncate the table core_url_rewrite in your database
Now refresh the magento home page.
Check weather the rows added to core_url_rewrite table.
You are done!.

Magento creating invoice redirect to wrong url

When I create an invoice from the order in the backend, this on this url:
http://www.site.com/index.php/safe/sales_order_invoice/new/order_id/4372/
But when the Invoice is about to be created it goes to:
http://www.site.com/shop/safe/sales_order/view/order_id/4372/
You see the (Shop), which is mostly correct because the storefront is named that(We had 2 storefronts once) If I remove the (Shop) part from the url, I'm getting back to the correct page and it shows that the invoice was correctly created. This only happens from the Order itself. If I use Mass action to create invoices from the orders list, it's not giving me any problems.
If anyone else has the problem (Using multi stores)
Please check your database, core_config_data and see if web/secure/base_url etc. is redirecting to the right path. And make sure to check that it's doing so for the right store ID that is giving you the trouble.
My problem was that the secure path for one of my stores, was ruining it.
All works fine now!

What's the point of the cataloginventory_stock_status_idx table?

I have tried really hard to understand the cataloginventory_stock relations - I do know that both the stock_item as well as stock_status tables get updated when a stock item gets modified, but I wasn't able to figure out whether the stock_status_idx table is really required.
From what I can see, the stock_status_idx table contains the same information as the stock_status table. Is it a temporary table only? I did not see any problems with wrong stock status if I manually updated the stock_item and stock_status tables, but did not update the stock_status_idx table.
The thing is.. I thought it's somehow used for caching/the indexer. However, even if I didn't modify the stock_status_idx table, the stock status displayed just fine in the backend and in the frontend.
So, what's the point of the stock_status_idx table?
Thanks so much for your help.
I was wondering the same question and decided to dig as I could not find an answer anywhere.
It seems like the _tmp and _idx are used as temp holders for your indexed data.
For example, you can look at the reindexAll() method in app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php and you will understand that it is using _idx tables to temporarily store it's data when generating the indexes:
$this->useIdxTable(true);
...
$idxTable = $this->getIdxTable();
....
$query = $select->insertFromSelect($idxTable, ...
At the end of the same method you will notice a nice $this->syncData() method call. You probably guessed it! The function lives in app/code/core/Mage/Index/Model/Resource/Abstract.php and is doing just that, syncs the _idx with main:
$this->_getWriteAdapter()->delete($this->getMainTable());
$this->insertFromTable($this->getIdxTable(), $this->getMainTable(), false);
$this->commit();
Best of luck!
idx table is used only when Magento need select many products based on their stock item, so the index on these tables are faster than use the main inventory tables.
I recommend you to write your data onto this table too. Or better, use Magento API or Magento App over PHP to write into Magento Database, is much more safe.
I looked into this for the same reason (to update stock quantities directly in Mysql) and will use the built in indexer feature of Magento with the "cataloginventory_stock" . I like this feature since it only takes a few seconds to run on my server.
you can reach the magento indexer and get some nice information
/[your store home]/shell then run: /usr/bin/php -f indexer.php info
here is the crontab line for running just the catalog inventory re-index:
30 3 * * * /usr/bin/php -f /home/client/www/shell/indexer.php -- --reindex cataloginventory_stock

"There was a problem with reindexing process." after product import

Using Magento 1.6
I had to make some bulk changes to my catlog and so did a full product export, made the changes then imported the ammended file.
Afterwards there were a few index that needed updating, all of them except the "Product Attributes" index correctly.
When I try to re index that one I get the error "There was a problem with reindexing process."
There are no new errors created in var/report and so I have no idea what the problem is.
csv -> http://lazytrek.com/magento_export.csv
edit - As per OSdave's suggestion I got the following error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '84-142-1-58' for key 'PRIMARY'
After struggling for hours I finally found a solution. In fact, It's a very simple solution:
Backup your database
Open phpMyAdmin and truncate (empty) the table catalog_product_flat_1
That's it. After that I was able to index all data and, until now, everything else works perfectly. This worked for me. I hope it works for you too.
PS: using Magento 1.6.0.0
OK I fixed this myself
In the SQL error the first number (in my case 84) indicates the product id, something did not import properly with that ID, I went into the product, saved it manually and hey presto I could re-index.
Hope that helps someone :-)
Remove the lock files in var/locks and try again.
I'd advise you reindex in SSH if you have a large data set
php shell/indexer.php -reindexall
Source :: https://magento.stackexchange.com/questions/24729/there-was-a-problem-with-reindexing-process
I also had this issue and was getting the following in my exception log:
Integrity constraint violation: 1062 Duplicate entry '706-168-2-60' for key 'PRIMARY''
Eventually I discovered (as posted above) that this was a problem with product ID 706 (the first digits before '-' are the product ID.
Simply opening this product within the Magento admin and saving it fixed the issue with this product, however, in my case I also had a problem with product 707, 708, 709, etc, etc...
What I then discovered is the second set of digits identify the attribute ID. I figured out which attribute this was by opening any attribute and replacing it's ID in the URL with the one in the exception log.
I then searched for a series of products (in my case 700 to 800), selected them all and used "Actions" "Update attributes" in the top right of the Catalog - Manage Products page.
I amended this attribute for all of them (which was fine for me) and the indexer worked.
If you can't set this attribute to be the same for all your products I'd suggest a bulk import to reset just this.
Last night, I was having the same problem. After following the steps outlined by OSdave to get the more precise error message, I saw my error was the same as yours.
But it wasn't just with 1 product there were several hundred products causing errors (each one saved brought up a new one). And it wasn't all with the same attribute (I'd updated multiple attributes across a database of over 4,000 products in my last import).
Since everything seemed to actually be in the database correctly (since re-saving seemed to be fixing it and giving the proper data to the final saved product), I had an idea.
Why not export all 4k products, and then re-import the same file without modification and see if that clears it.
It worked!
tl;dr: If you're having this problem with multiple products needing to be re-saved, export your whole inventory (or the relevant section if you can segment in a useful way), and re-import the same file with no modifications.
I'm using Magento v 1.9.0.1
Thanks OSdave,
It's same error for me, I changed this
in Mage_Index_Adminhtml_ProcessController edit line 138, from Mage::helper('index')->__('Cannot initialize the indexer process.') to $e->getMessage():
then tried re-index, it's shows the below error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8308-2018-1-2788' for key 'PRIMARY', query was: INSERT INTO catalog_product_index_eav_idx (entity_id,attribute_id,store_id,value
then, I remove the product with ID '8308' and recreated and after tried to re-index, it working fine.
But don't the exact root cause of issue. I hope it's help to someone!
Double check the catalog_product_entity,catalog_product_entity_datetime,catalog_product_decimal,catalog_product_int, catalog_product_text,catalog_product_varchar table columns have with respective UNIQUE KEY's.

magento, error when reindexing Catalog URL Rewrites

All this afte rupgrading from 1.4.1
I get a quite specific error message:
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/19-1-2' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/in-due/domains/sb2.in-due.de/public_html/hochzeitsshop/lib/Zend/Db/Statement/Pdo.php:234
problem is, that I don't know how to find the entry, that is making trouble. neither in the backend (catalog|URL Rewrite Management) nor in the db itself (table core_url_rewrite) is an entry
product/19-1-2
any help is appreciated,
PAT ERLER
#perler, here is a MySQL query to detect duplicate SKUs. Remember, if you prefixed your tables, change catalog_product_entity accordingly!
SELECT
DISTINCT(`sku`) as `sku`,
COUNT(`sku`) as `skuCount`,
entity_id
FROM
catalog_product_entity
GROUP BY
`sku`
HAVING
`skuCount` > 1;
The duplicate entry is for a key made up from 3 fields, id_path, is_system and store_id, in theory you should be able to use URL Rewrite Management, search for an id_path of product/19 and this is your 'troublesome' field. Deleting that value may solve the issue (but I'd recommend making a backup first, and trying it in a dev environment first).
If you are still in development and haven't used any custom rewrites you could just empty the core_url_rewrite table and re-index to regenerate all the fields. If it is a live site this would be a little more troublesome, it would mean losing a bit of SEO juice if you have renamed products, since you would lose the rewrite.
Ok, the problem was a duplicate SKU. You shouldn't be able to enter one, but what happened (in magento 1.4.0.1) was, that the client entered a very long SKU which got shortened when saving the product. the shortened part was then identically to another SKU.
so, if yourself have this problem, check you database for duplicate SKUs (can someone post an SQL Query to do this?)

Resources