0

Here i need to solve some issue where,

  1. When i click on the product image (BLUE CIRCLE), in the Best seller block, we are redirected towards the Home Page
  2. Similarly, when the name of the product is clicked (RED CIRCLE), some other page is opened.

I think if someone could help me in changing the link of the pages that are being redirected, would solve the issue.

I want the product page to get opened, wheather we click on the product image OR we click on the name of the product.

THANKYOU IN Advance

Best Seller Block create('\Magento\Catalog\Model\ResourceModel\Product\Collection'); $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface'); $storeId = $storeManager->getStore()->getId(); $collection = $productCollectionFactory->addAttributeToSelect('*'); $collection->getSelect()->joinLeft( 'sales_order_item', 'e.entity_id = sales_order_item.product_id', array('qty_ordered'=>'SUM(sales_order_item.qty_ordered)')) ->group('e.entity_id')->limit(8); $imageHelper = $objectManager->create('Magento\Catalog\Helper\Image'); $_helper = $objectManager->create('Magento\Catalog\Helper\Output'); $priceHelper = $objectManager->create('Magento\Framework\Pricing\Helper\Data'); ?>

products-"> "; // print_r($_product->getData()); $product_data = $_product->getData(); //echo "
";
                    // print_r($product_data);
                        //  echo  $product_title = $product_data['meta_title'];
                          // $product_title_url = str_replace(' ','-',$product_title);
        //                  $product_title_url = strtolower($product_title_url).'.html';
                    ///exit;
                    ?>
                    ' : '' ?>
                        
                    getId();?>" data-container="product-grid">
                        
                        getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
                            
                                
                                    init($_product, 'product_page_image_large')
                                                ->keepAspectRatio(TRUE)
                                                ->keepFrame(FALSE)
                                                ->resize(285, 285)
                                                ->getUrl();
                                    ?>
                                    " />
                                
                            
                        
                        
                        
                               
                                
                                    getName(); ?>   
                                
                            
                        
                          getId(); ?>">
                                
                                    getId(); ?>-widget-product-grid" data-price-amount="getPrice(); ?>" data-price-type="finalPrice" class="price-wrapper ">
                                        currency($_product->getPrice(), true, false); ?>
                                    
                                
                            

                                


                                             
                                        isSaleable()): ?>
                                            create('Magento\Checkout\Helper\Cart');
                                                $formKey = $objectManager->get('Magento\Framework\Data\Form\FormKey'); 
                                                $wishlistHelper = $objectManager->create('Magento\Wishlist\Helper\Data');
                                                $wishlistUrl = $wishlistHelper->getAddParams($_product);    

                                            ?>
                                            getAddUrl($_product); ?>" method="post">
                                                getId(); ?>" />
                                                getFormKey();?>">
                                                "
                                                        class="action tocart primary">
                                                    
                                                
                                            
                                        
                                            getIsSalable()): ?>
                                                
                                            
                                                
                                            
                                        

                                        

                                   create('Magento\Customer\Model\Session');
                                    // $customerSession->setMyValue('test');
                                    $wishlistHelper = $objectManager->create('Magento\Wishlist\Helper\Data');
                                                    $wishlistUrl = $wishlistHelper->getAddParams($_product);
                                   ?>

                                    isLoggedIn() == false){  ?> onclick="social_popup('popup')" ">
                                        isLoggedIn() == false){  ?>
                                          isLoggedIn() == true){
                                                     ?> 
                                               role="button" title=""
                                               aria-label=""

                                               data-post=''
                                                 >
                                                
                                                
                                                
                                            


                                         "
                                               aria-label=""

                                               data-post=''
                                               >
                                              
                                              
                                                
                                            
                                            
                                            
                                    

                                

                    
                    
                

                <?php echo($iterator == count($collection) + 1) ? '</li>' : '' ?>
            <?php endforeach; ?>
        </ol>
    </div>
    </div>
</div>
</div>

$(document).ready(function(){ $("#flexiselDemo1s").flexisel({ visibleItems:4, animationSpeed: 1000, itemsToScroll: 1, autoPlaySpeed: 3000, infinite: true, navigationTargetSelector: null, autoPlay: { enable: false, interval: 5000, pauseOnHover: true }, enableResponsiveBreakpoints: true, responsiveBreakpoints: { portrait: { changePoint:480, visibleItems: 1 }, landscape: { changePoint:642, visibleItems: 2 }, tablet: { changePoint:769, visibleItems: 3 } } }); }); <?php

// $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager // $resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); // $connection = $resource->getConnection();

// //Select Data from table // $sql = "SELECT t2.value FROM catalog_product_entity_int t1 LEFT JOIN catalog_product_entity_int t2 ON t1.entity_id = t2.entity_id WHERE t2.attribute_id = '166' AND t1.value = '247'"; // $result = $connection->fetchAll($sql); // gives associated array, table fields as key in array. // echo '<>'; // print_r($result); ?>

  • Please share you phtml code of best seller block. Thanks – Prathap Gunasekaran Feb 20 at 9:53
  • Where do i find the phtml code of the best seller block ? – rajk53 Feb 20 at 9:56
  • I found the solution, By changing the visibility in the product details page in the backend, i changed the visibility to Catalog, Search. Now the link is working. But now the problem is that the links are different for both the product image & the product name. Please help Thanks – rajk53 Feb 21 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.