Get product FINAL price without loading entire productWhat is faster - getting raw attribute value or use...
A poker game description that does not feel gimmicky
How to make payment on the internet without leaving a money trail?
Doomsday-clock for my fantasy planet
Creating a loop after a break using Markov Chain in Tikz
COUNT(*) or MAX(id) - which is faster?
aging parents with no investments
What is it called when one voice type sings a 'solo'?
What is GPS' 19 year rollover and does it present a cybersecurity issue?
Why do UK politicians seemingly ignore opinion polls on Brexit?
Information to fellow intern about hiring?
Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?
Is this relativistic mass?
Does the average primeness of natural numbers tend to zero?
Is Social Media Science Fiction?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Are white and non-white police officers equally likely to kill black suspects?
Why is my log file so massive? 22gb. I am running log backups
Symmetry in quantum mechanics
Uplifted animals have parts of their "brain" in various locations of their body. Where?
Short story: alien planet where slow students are executed
Unbreakable Formation vs. Cry of the Carnarium
Could a US political party gain complete control over the government by removing checks & balances?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
Need help identifying/translating a plaque in Tangier, Morocco
Get product FINAL price without loading entire product
What is faster - getting raw attribute value or use collection?How do I use a custom attribute as the final price of a product?How can I delete configurable product attributes?Display product price without loading whole productObtain final price(s) of item(s) after promotion rules applied?Get final price of configurable optionUse final price in addFieldToFilterMagento 1.9 custom soap api module cannot get product final price from collectionHow to check final price or special price is valid or expire on magento 1.9Magento2 Apply catalogrule on final price instead original priceHow to get final price of a product by rest API?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I can get product attributes efficiently without loading the entire product by using:
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
However, I can only do this with the price
'attribute, since final_price
is technically not an attribute. Since I'm grabbing a few hundred products on one page load, and the only data I need is the product's final price, doing this is very inefficient:
foreach($productIds as $productId) {
$finalPrice = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
....
}
Since I'm loading the entire product. If anybody can suggest a more efficient way, I would really appreciate it. Cheers!
magento-1.9 attributes price product-collection special-price
add a comment |
I can get product attributes efficiently without loading the entire product by using:
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
However, I can only do this with the price
'attribute, since final_price
is technically not an attribute. Since I'm grabbing a few hundred products on one page load, and the only data I need is the product's final price, doing this is very inefficient:
foreach($productIds as $productId) {
$finalPrice = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
....
}
Since I'm loading the entire product. If anybody can suggest a more efficient way, I would really appreciate it. Cheers!
magento-1.9 attributes price product-collection special-price
add a comment |
I can get product attributes efficiently without loading the entire product by using:
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
However, I can only do this with the price
'attribute, since final_price
is technically not an attribute. Since I'm grabbing a few hundred products on one page load, and the only data I need is the product's final price, doing this is very inefficient:
foreach($productIds as $productId) {
$finalPrice = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
....
}
Since I'm loading the entire product. If anybody can suggest a more efficient way, I would really appreciate it. Cheers!
magento-1.9 attributes price product-collection special-price
I can get product attributes efficiently without loading the entire product by using:
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
However, I can only do this with the price
'attribute, since final_price
is technically not an attribute. Since I'm grabbing a few hundred products on one page load, and the only data I need is the product's final price, doing this is very inefficient:
foreach($productIds as $productId) {
$finalPrice = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
....
}
Since I'm loading the entire product. If anybody can suggest a more efficient way, I would really appreciate it. Cheers!
magento-1.9 attributes price product-collection special-price
magento-1.9 attributes price product-collection special-price
edited 25 mins ago
Muhammad Anas
459215
459215
asked May 8 '17 at 19:45
Shaquille Adam Jessop DavisShaquille Adam Jessop Davis
1114
1114
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using ->addFinalPrice()
will add something like this to collection query ...
,
price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
and
INNER JOIN
catalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
I'd us a colletion like
$collection = Mage::getResourceModel('catalog/product_collection')
->addIdFilter($productIds)
->addFinalPrice();
foreach ($collection as $product) {
$finalPrices[] = $product->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 2,131,092 microsecs
- Total Incl. CPU (microsecs): 2,109,925 microsecs
- Total Incl. MemUse (bytes): 4,776,976 bytes
- Total Incl. PeakMemUse (bytes): 4,829,112 bytes
- Number of Function Calls: 103,275
compared to
foreach($productIds as $productId) {
$finalPrices[] = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 116,555,318 microsecs
- Total Incl. CPU (microsecs): 114,323,845 microsecs
- Total Incl. MemUse (bytes): 22,853,768 bytes
- Total Incl. PeakMemUse (bytes): 23,126,448 bytes
- Number of Function Calls: 5,465,676
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173511%2fget-product-final-price-without-loading-entire-product%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using ->addFinalPrice()
will add something like this to collection query ...
,
price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
and
INNER JOIN
catalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
I'd us a colletion like
$collection = Mage::getResourceModel('catalog/product_collection')
->addIdFilter($productIds)
->addFinalPrice();
foreach ($collection as $product) {
$finalPrices[] = $product->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 2,131,092 microsecs
- Total Incl. CPU (microsecs): 2,109,925 microsecs
- Total Incl. MemUse (bytes): 4,776,976 bytes
- Total Incl. PeakMemUse (bytes): 4,829,112 bytes
- Number of Function Calls: 103,275
compared to
foreach($productIds as $productId) {
$finalPrices[] = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 116,555,318 microsecs
- Total Incl. CPU (microsecs): 114,323,845 microsecs
- Total Incl. MemUse (bytes): 22,853,768 bytes
- Total Incl. PeakMemUse (bytes): 23,126,448 bytes
- Number of Function Calls: 5,465,676
add a comment |
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using ->addFinalPrice()
will add something like this to collection query ...
,
price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
and
INNER JOIN
catalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
I'd us a colletion like
$collection = Mage::getResourceModel('catalog/product_collection')
->addIdFilter($productIds)
->addFinalPrice();
foreach ($collection as $product) {
$finalPrices[] = $product->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 2,131,092 microsecs
- Total Incl. CPU (microsecs): 2,109,925 microsecs
- Total Incl. MemUse (bytes): 4,776,976 bytes
- Total Incl. PeakMemUse (bytes): 4,829,112 bytes
- Number of Function Calls: 103,275
compared to
foreach($productIds as $productId) {
$finalPrices[] = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 116,555,318 microsecs
- Total Incl. CPU (microsecs): 114,323,845 microsecs
- Total Incl. MemUse (bytes): 22,853,768 bytes
- Total Incl. PeakMemUse (bytes): 23,126,448 bytes
- Number of Function Calls: 5,465,676
add a comment |
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using ->addFinalPrice()
will add something like this to collection query ...
,
price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
and
INNER JOIN
catalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
I'd us a colletion like
$collection = Mage::getResourceModel('catalog/product_collection')
->addIdFilter($productIds)
->addFinalPrice();
foreach ($collection as $product) {
$finalPrices[] = $product->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 2,131,092 microsecs
- Total Incl. CPU (microsecs): 2,109,925 microsecs
- Total Incl. MemUse (bytes): 4,776,976 bytes
- Total Incl. PeakMemUse (bytes): 4,829,112 bytes
- Number of Function Calls: 103,275
compared to
foreach($productIds as $productId) {
$finalPrices[] = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 116,555,318 microsecs
- Total Incl. CPU (microsecs): 114,323,845 microsecs
- Total Incl. MemUse (bytes): 22,853,768 bytes
- Total Incl. PeakMemUse (bytes): 23,126,448 bytes
- Number of Function Calls: 5,465,676
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using ->addFinalPrice()
will add something like this to collection query ...
,
price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
and
INNER JOIN
catalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
I'd us a colletion like
$collection = Mage::getResourceModel('catalog/product_collection')
->addIdFilter($productIds)
->addFinalPrice();
foreach ($collection as $product) {
$finalPrices[] = $product->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 2,131,092 microsecs
- Total Incl. CPU (microsecs): 2,109,925 microsecs
- Total Incl. MemUse (bytes): 4,776,976 bytes
- Total Incl. PeakMemUse (bytes): 4,829,112 bytes
- Number of Function Calls: 103,275
compared to
foreach($productIds as $productId) {
$finalPrices[] = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
}
- Total Incl. Wall Time (microsec): 116,555,318 microsecs
- Total Incl. CPU (microsecs): 114,323,845 microsecs
- Total Incl. MemUse (bytes): 22,853,768 bytes
- Total Incl. PeakMemUse (bytes): 23,126,448 bytes
- Number of Function Calls: 5,465,676
edited Jul 29 '17 at 15:37
answered May 9 '17 at 16:05
sv3nsv3n
9,93662456
9,93662456
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173511%2fget-product-final-price-without-loading-entire-product%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown