Questions tagged [random]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
0answers
42 views

Page getting cached in Magento 2

I am trying to display random products on the homepage. but my page is getting cached and on refresh, same products are displayed. I used AJAX post request also but did not work. Can anybody say how ...
1
vote
1answer
31 views

Using AJAX for displaying Random Products on Home Page

Can any one give me an example of Displaying Random Products on homepage using AJAX in Magento 2.3
0
votes
2answers
34 views

Magento 2.3 : Select Random Product id from Product collection

Is there any way to select random product ID from product collection object in magento 2.3 $_productCollection = $this->getProductList($catid); How can I select random product id from this object
0
votes
4answers
70 views

Select Random Products magento 2.3

I want to display random products on my homepage. I have been using this $collection->clear()->getSelect()->order('rand()');. My aim is the products should be displayed randomly on every page ...
0
votes
0answers
23 views

Show random product images Magento 1.9.x

I'm kinda stuck with a Magento project. My client has products with each product having multiple images. I want to show a random product image from each product in the shop on the homepage. I ...
1
vote
2answers
386 views

How to Shuffle Product Collection in Magento 2?

I am getting products collection form multiple categories. I want to shuffle products everytime when function getProductCollection() is called. My function is: public function getProductCollection($...
0
votes
2answers
661 views

Magento 2: How to retrieve a random product from a random category?

Magento 2.2, developing a custom theme whose parent is Magento/blank. I intend to create a module which generates a random discount weekly. Firstly, I must retrieve a random product from a ...
2
votes
2answers
2k views

Generating a random string

Is there a core class (preferably a framework class) in Magento 2 that can be used to generate random strings? Length of the string is not important. I don't want to reinvent the wheel and write my ...
-1
votes
1answer
68 views

How can i give discount for random 2 products get 10% discount [duplicate]

If a customer chooses item1 and item 2, get 10 % discount from grant total. How can i give a discount?
0
votes
1answer
445 views

Disable cache for custom block file in Magento 2 [duplicate]

I want to show random product collection on custom template. But It is showing random product only after clear cache otherwise it shows same products. Please help.
1
vote
1answer
244 views

Displaying Search results in a random order

I need to display the products on the search results page in a random order. Since there is no official explanation on how to do this, I tried to edit the Mage_CatalogSearch_Model_Resource_Fulltext ...
0
votes
1answer
158 views

Changing an image randomly

Guys I would like to change the image when a person enters the site, for example, have a static block that loads an image and when a person enters or gives an F5 I would like to change the name of the ...
1
vote
1answer
2k views

Block “catalog/product_list_random” shows no products in CMS

I'm using Magento 2.0.2. I want to display a random collection of products from the catalog on my home page. In the CMS for my home page, i use the following code: <p>{{block type="catalog/...
0
votes
2answers
262 views

Adding random product listing for categories

How i can add a new option in the drop down product listing in category layout? I saw a lot of threads which customize template\catalog\product\list.phtml But i think adding a new dropdown option is ...
0
votes
2answers
669 views

Get 1 random product from several categories [duplicate]

For a product page I'd like to show 1 random product from each of the 3 preselected categories. The final layout would be 3 products next to each other (1 from each category). Now I have read several ...
1
vote
1answer
843 views

Any way to shuffle the output of $this->getLoadedProductCollection()

Is there any way to shuffle this foreach? I tried shuffle($_productCollection) and array_rand($_productCollection) but nothing worked :( <?php $_helper = $this->helper('catalog/output'); if (...
1
vote
3answers
1k views

Listing Random Products from all Subcategories of a Parent Category

I need some help. I have the following category structure category>subcagtegory>subsubcategory The parent is an empty category that serves as a landing page. I need to display a list of random ...
0
votes
2answers
87 views

Show random products from multiple preselected categories

I have seen multiple posts about random products here ... But mine is a bit different. What i would like to to do: Day one: Lets say 8 .... (could change later on) random products selected from ...
1
vote
1answer
1k views

shuffle() full collection?

On the catalog product list view I can use shuffle() on the product collection however it only shuffles a small proportion (e.g. 10) of the full collection (hundreds). There is also infinite ajax ...
1
vote
2answers
1k views

Get 5 Random Product IDs From Product Collection

I am looking to create a custom product collection using specific product attributes as filters. The product collection I am getting has well over 100 products in which is fine but I need to find a ...
0
votes
1answer
210 views

Display Random Products on CMS Page [closed]

I used this code {{block type="catalog/product_list_random" name="product_random" template="catalog/product/list.phtml" column_count="3"}}. Thats Works fine, but there is a Problem. If you open my CMS ...
5
votes
1answer
273 views

How is Varien_Db_Adapter_Pdo_Mysql::orderRand() optimized?

Magento comes with a method to randomly "order" collections: $collection->getSelect()->orderRand(); It takes an optional parameter $field, that is eventually used in ...
3
votes
2answers
3k views

Random product collection from custom module extends Mage_Catalog_Block_Product_List not working

This code is not working class My_Module_Block_New_New extends Mage_Catalog_Block_Product_List { ... protected function _getProductCollection() { if (is_null($this->_productCollection)) { ...
1
vote
1answer
264 views

Need help with display random products code

I wanted to generate random products for certain categories on my home page. Came across this code: <?php // $_productCollection = $this->getLoadedProductCollection(); $_helper = $this->...
2
votes
3answers
3k views

How do i get random Cross Sell Products?

This is the piece of code that generates the cross products: <?php $_helper = $this->helper('catalog/output'); ?> <?php $_product = $this->getProduct(); // echo get_class($...
0
votes
1answer
1k views

Generate random related products

I have this piece of code, which generates me 6 related products from a total number of products. I want to generate it randomly. Is there a function in magento to do that ? thx This is the LINK to ...
4
votes
2answers
9k views

show random products from a category

On my cart page i have a little display, which shows products from a certain category, it displays 4 products, but in my category i have 8-10 products. How can i make it select random products so it ...
3
votes
3answers
2k views

Random products from same category with parent category fill up

I would like to do following on 1.9.0.1: Getting 12 random upsell-products from same category as current product. They have to be saleable. They shouldnt be in related-products already. They shouldnt ...
0
votes
1answer
540 views

Random Featured products

I have a Featured products category whihc has some of our best selling products in (15 products) I have them displaying on my home page. This section on my home page shows 5 random products at a time ...
3
votes
2answers
2k views

Random products in product widget

I currently have 4 widgets on my front page that display 4 products each. At the moment it uses either featured products, special producs or hot products to decide which products to populate the ...
7
votes
3answers
9k views

Four Random Products on Homepage

I'm trying to get 4 random products on the homepage using PHP within a TPL file I've created. I'd like to be able to format the products in a foreach loop as I'm using some formatting in the code seen ...