Find Jobs
Hire Freelancers

Change random selection method in a function in Magento

$10-30 USD

Terminado
Publicado hace más de 10 años

$10-30 USD

Pagado a la entrega
Our Magento installation has a home page block which displays a random selection of products from a given category. It works, but it's really slow. I tracked the culprit down to the following function: protected function _getProductCollection() { if (is_null($this->_productCollection)) { $categoryID = $this->getCategoryId(); if($categoryID) { $category = new Mage_Catalog_Model_Category(); $category->load($categoryID); $collection = $category->getProductCollection(); } else { $collection = Mage::getResourceModel('catalog/product_collection'); } Mage::getModel('catalog/layer')->prepareProductCollection($collection); if ($this->getIsRandom()) { $collection->getSelect()->order('rand()'); // REALLY slow, approx 4000ms at 25k products } $collection->addStoreFilter(); $productCount = $this->getProductCount() ? $this->getProductCount() : 8; $collection->setPage(1, $productCount) ->load(); $this->_productCollection = $collection; } return $this->_productCollection; } Specifically, it is the $collection->getSelect()->order('rand()'); statement that is extremely slow, adding around 4000ms to our time to first byte at our current product count of ~25k. Simply disabling randomness shaves about 3700ms off our page load time. I would like to perform the randomization at application level, rather than use the notoriously slow MySQL ORDER BY RAND() method. Specifically, I would like you to implement the method described here: [login to view URL] The deliverable is the updated _getProductCollection() function pasted above, modified to use an application level randomization method. The suggested solution is one, but you're free to use any method you choose, as long as it works and it's fast.
ID del proyecto: 5142133

Información sobre el proyecto

7 propuestas
Proyecto remoto
Activo hace 10 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Hi, i can fix it in a hour. Thanks, Bojan .
$35 USD en 1 día
4,9 (59 comentarios)
5,8
5,8
7 freelancers están ofertando un promedio de $38 USD por este trabajo
Avatar del usuario
Hi, I was working with magento from 2008. I often provide Magento extension and Magento theme. I have exp with upgraded, import data, themes, tax, payment, sales, shipping, SEO, etc... Please see my profile for more information. Best regards, dannv =================http://www.mlx-store.com==================== Time works(GMT +7): - Morning: 00:00 -> 5:00 - Afternoon: 13:00 -> 18:00 - Tonight: 21:00 -> 24:00
$34 USD en 1 día
4,9 (240 comentarios)
7,2
7,2
Avatar del usuario
Hi, That is a simple task. With my 5 years magento development I would love to do more for you in the future issues if you have. Please contact me via skype ndthan25 and I will change it for you. Regards,
$25 USD en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de SWEDEN
Stockholm, Sweden
5,0
4
Forma de pago verificada
Miembro desde sept 21, 2013

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.