Question to display related products.

Hello

I need a type of "those who watched this also watched these?" of the thing.  You have probably seen on trolleys.  They are common enough, but I'm not sure of the logic.

I work with PHP & MySQL on a dynamic page of population.  The page can contain any product from the database.

So if the product being viewed now is class A, I want to display 4 random thumbnails of category A...  Similarly, if the current product is class B, I want pictures of category B and so on...

I got A LOT of Categories.  So what is the best way to do this?

Nancy O.

You would need a column "product_category" in your database.

When you get the details of the initial product, also get the "product_category" and assign it to a variable:

$getProductDetails = $conn-> query ("SELECT * FROM Products WHERE the product_id = ' $product_id '") or die ($conn-> error);

$getProductDetails = $getProductDetails-> fetch_assoc();

$product_category = $getProductDetails ["product_category"];

Then check the variable $product_category against the database column "product_category":

<>

Get 4 random products to display by category of products table

$selectRandomProducts = $conn-> query ("SELECT * FROM Products WHERE the product_category = ' $product_category ' ORDER OF RAND() LIMIT 4") or die ($conn-> error);

?>

Then, wrap echo on the results of the $selectRandomProducts variable with the help of some time:

fetch_assoc()) {? >}

You should get to where you need to be.

Tags: Dreamweaver

Similar Questions

  • Customizing the Table of related products

    Working with a sensitive layout, I have a problem with the table of related products using the {tag_relatedproducts}. I got the layout of small product to respond well, but not when it appears in the productTable productItem table of the elements. Tips for each productItem stack, with every other compensation?

    Thanks in advance!

    Never mind. I simply applied the following CSS

    TR .productItem {}

    Width: 100%;

    height: auto;

    Clear: both;

    display: block;

    }

  • Custom template for related products?

    So, this is the first time I try to customize an ecommerce solution beyond the normal stuff of the BC. Customer wants a specific view for related products, so my first thought was to use a custom template, but it doesn't seem to work.

    So I almost with the help of the model of module, a decline in the amount of 1 - and hoping I can use a custom template for the display of the small product instead since I use that related products.

    I forgot something? Is it possible to use a custom template for the {tag_relatedproducts}?

    Thank you Joel however I have more control over the layout as a few styles of it. I ended up jumping in with the beta version of liquid to get what I need, what gave me some other customizations.

    TAGS cannot take a custom template variable, I chose to store it in a tag "capture." So based on some conflicts of naming of my catalog images, I was able to target specific catalogs, then browse related products and build them up as I wanted.

    Here is an example of what I chose to go with.

    {capture products %} %

    {tag_productlist, true true, 3,}

    {% for %} endcapture

    model {module_catalogue catalogId = "{{this.id"}} "=" "collection ="cat"}

    {tag_name}

    {% If {cat.imageUrl} contains 'show' and ({{this.id}} == {{tag_productlist_5_8.catalogId}}%}}

    {tag_productlist, true true, 3,}

    {% elsif {cat.imageUrl} contains "display" %}

    {% for %} tag_productlist_5_8.items products

    REF #: {{product.custom3}}

    MFG #: {{product.custom2}}

    Price: {{product.saleprice}}

     

    {% endfor %}

    {% products.items %} elsif

    {tag_cataloguelist, true true, 2,}

    {% for %} tag_catalogueList_3_9.items products

    Price: {{product.saleprice}}

    {% endfor %}

    {% other %}

    {tag_cataloguelist, true true, 2,}

    {tag_productlist, true true, 3,}

    {% endif %}

  • In order to become a distributor of volume Adobe Reader, (my computers have no internet access), I need to fill out the Distribution of Volume License Agreement, but will not accept an answer I gave to the question: "Please indicate the product or service

    In order to become a distributor of volume Adobe Reader, (my computers have no internet access), I need to fill out the Distribution of Volume License Agreement, but will not accept an answer I gave to the question: "Please indicate the product or service name and description.

    This form must be completed and submitted online. Also the browser Javascript must be activated.

    https://distribute.Adobe.com/mmForm/index.cfm?name=distribution_form&PV=RDR

  • liquid related products

    Hi guys ive just started setting up for liquid and thought, I wish to begin by making related products on a tabular presentation.

    I added this code to my great product

    RELATED PRODUCTS

    {tag_relatedproducts, 4, true model = "" collection "relatedProducts" = "}     {% for article on relatedProducts.items-%}
    Placeholder image
    {{item.custom1}}

    {{item.name}}

    {{item.salePrice}}

    {tag_addtocart}
    {% endfor}

    I'm not sure if this is the right way to do it but it seems to work ok... only my price have no $ and my product names have no connection with great view.

    Screen Shot 2015-07-24 at 5.08.50 pm.png

    That's why im im thinking something wrong.

    This | JSON on my articles or whatever it is you gets all the information output.

    Take a look at to see what you get.

  • Is there a liquid tag for related products?

    It doesn't seem to be liquid tag for related products. I am now using {tag_relatedproducts}.

    I would use {{relatedproducts}} because I would use Reiunnaitre = "true" to get rid of the default table.

    Am I missing something or is there no liquid tags for related products? It would be useful to have a.

    If she is not there, is there another way to use a list instead of a table for related products?

    Thank you.

    That's what said Liam...

    For related products as a liquid, use a collection on your {tag_relatedproducts}:

    {tag_relatedproducts, 4, true model = "" collection "relatedProducts" = "}

    {% If relatedProducts.items-%}

    {% for article on relatedProducts.items-%}


    {{ item | json }}

    {% endfor}
    {endif %}

    NB: Please take note of the specific command model = "" before = "yourVariableName" in this case. " Trust me, you exchange these autour, in some cases, product related collection will be empty. I can't emphasize this point enough.

    Hope this helps

    -Stephen

  • Elements of related products that overlap

    Hello

    I put related products at the bottom of the page, I'm trying to adjust the spacing between the elements.

    I can't find the CSS to change this option. Help, please.

    http://puzzlefurniture.worldsecuresystems.com/lounge-Suite/Bolzano-2-seater-sofa

    Thank you!

    Hey,.

    This occurs because the images of 3 products are sqezed in this column - http://screencasteu.worldsecuresystems.com/Mihai/2012-08-06_1133.png

    To avoid this you must overwrite the width = 100% property here - http://screencasteu.worldsecuresystems.com/Mihai/2012-08-06_1134.png - in this example, I put it manually to 800px. The opposite would be to change the layout of the page.

  • See related products in Dreamweaver

    Hi all I am fairly new to all this, so forgive me! I'm doing a site for my brother who will sell the body of the guitar and their corresponding parts. I have install a single mysql - one of the fields database table determines if the input is an organ or a part - there is also a field in which (if it is a part) the body its bound to is entered. Thus part54 maybe related to the Appeal1 for example. I have set up a page in DW CS5 that correctly displays the bodies, I then created a second set of records that I'm trying to filter by the current record in the first Recordset. If the user displays the point number 1 then all the parts related to this product can be listed on the same page (and eventually clicked for more information). I am really struggling to find a way to refer to the current record is displayed in the first set of the second. Please can you advise me? Thus, in English Recordset2 must display all records where the relateditemfield = the currently displayed record. I hope I gave enough information here, please shout if not. Thanks in advance. John.

    Take the information from my last post and reverse the logic... The php code is displayed on your page and not processed by the server because you do not have an opening tag.

  • 2 questions - 1 - display a graphic and 1 - print

    Hello

    Have 8 of Adobe Standard on Win XP and I have 2 problems. Received a PDF and a graph (diagram) is not displayed on the screen. It print. I've updated the video driver, but has not made any change in the display.  The second question may or may not be related, is that when printing the left quarter of the page is out of the page. The page size of the document is 11 x 17 and I select to fit the printable area, to 8 1/2 x 11 landscape. the page is up and down but that is long left right. Opened and printed the document very well on another computer with Acrobat 8 Standard.

    Thanks in advance.

    Not sure about printing. To display the question go to preferences > Page display and turn on
    'Display large images '.

  • Question external display

    Hello

    I recently bought a henge dock and the external display for my MacBook Pro 15 "."

    The henge dock has a bolt of lightning from the macbook. My monitor has an extra display port and HDMI in, this looks a bit similar to HDMI. I'm looking for a cable to use thunderbolt out in the display on the external monitor port. I can find a few inexpensive options online, but I would go for quality rather than price and wonder what is the best solution in this case to HDMI.

    Thank you

    This cable should do the trick: http://www.apple.com/shop/product/HHLY2ZM/B/belkin-4k-mini-displayport-to-hdmi-c have-2-m-65-ft

    (In case you're wondering: the mini display plug in the thunderbolt port.)

  • Question on display on the Satellite A100-709

    Dear Sir.

    I bought the Toshiba Satellite A100-709 15 wxga TruBrite TFT display. S. n: 86290992q. Purchase date 10 February 2007. But while I was working display couldn't all off a sudden. View life is only 2 or 3 years. Is Toshiba views are long term, life is not insured?

    How to take the matter with TOSHIBA?

    Vincent

    Hello Vincent

    I have the Satellite M70 with the same screen. I use it extensively almost 4 years now and display still works perfectly.
    Hardware failure is nothing exceptional for all electronic products. On some of them, some components are working longer. There is no general statement about it.

    Please contact nearest Toshiba authorized maintainer and talk with them. Pick up information on the repair and costs.

    Sorry, but everything what s that I can say on this issue of the display. :(

  • Question on recovery of product for Satellite A30 - 514

    After the start of recovery of product using OS provided a disk displayed the Setup with error number 11122 stops with the message "cannot load the bitmap file. height max 100 ".

    Also asked why recovery at startup on screen message States, loading of Windows 98, then the home XP was preinstalled on the computer.
    Any ideas?

    Hello

    Do you use a recovery CD or original copy? Satellite A30 is a unit old enough and I wonder since when you noticed this problem?

    Recovery procedure is running in MS-DOS mode. Because of this, there are still listed W98. Thing absolutely unimportant.

  • X120e-Thinkvantage Toolbox displays wrong product id

    Hi everyone, this is going to be a bit long, so thank you in advance for your patient. :-)

    The boot loop (explained in a previous post) my problem was solved by changing the motherboard. I'm happy to have my operational x120e.

    Now, I have a very annoying problem. After receiving the laptop, I immediately put to update the latest bios firmware.

    Later I discovered that after I installed the new mobo to the center support they did not update the type of product, a serial number of the machine in the BIOS. So the thinkvantage Toolbox displayed an incorrect product id: qqqq2ru. As you can imagine that the system cannot be automatically updated because there is no product with this identification number.

    After hours of searching on Google I found a copy of the disk of hardware maintenance (v1.78, please don't ask me how I did it) and I managed to update the BIOS with the right product and SN. I thought, oh, what a relief to e. This until the computer is restarted. The Toolbox now shows the correct SN but the same incorrect product id: qqqq2ru

    I thought that maybe I should reinstall the system to factory default. Done, but the result is the same. My product in the Toolbox TV id is on qqqq2RU, although in the bios, I see the correct model, in my case 05962RU.

    Can anyone shed light on what could be the problem?

    Any help will be much appreciated.

    Thanks in advance

    abvasili

    OK, I solved this.

    Aparently, the cause of the problem was Flash new bios without the first writing of the info in the BIOS (Serial Number, type of product, etc.)

    I have downgraded the bios with an old version and deleted the product type. Voila. ThinkVantage Toolbox recognized my product id, etc. of SN. After that, I updated the bios with the latest version and now everything is fine.

    Hope this will help someone with the same problem in the future.

    Thanks for reading.

    abvasili

  • * Critical question * Qfecheck not related to update KB969897 for Windows 2000

    For some reason, qfecheck reports no updates for internet explorer 6 for windows 2000. He noted, however, the same updates for windows xp.

    Troubleshooting steps already made on update KB969897:

    1. look for the new version of qfecheck
    2 Verfied update has been installed (WSUS, registry and file versions)
    3 update applied manually
    4 Verfied that registry entries have the correct permissions (full system)
    5 Ran windows xp version of qfecheck

    Additional information:
    The registry entry for KB969897 location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP0\KB969897-IE7 (XP)
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Internet Explorer 6\SP1\KB969897-IE6SP1-20090501.120000(Windows 2000)

    Information of qfecheck:
    http://support.Microsoft.com/?kbid=282784

    Hi TechNet_User_1000,

    Thank you for visiting the website of Microsoft Windows Vista Community. The question you have posted is related to Windows XP (and 2000) and would be better suited to the Windows XP community. Please visit the link below to find a community that will provide the support you want.

    http://www.Microsoft.com/windowsxp/expertzone/relatedcomm.mspx

    Thank you
    Dave D
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Comples little question about the transfer product key

    I have a HP (SR5518F) computer and origianally comes with vista, I downgraded to xp, but as time passed gradually began to fall so I decided to restore vista but found the restore partition has been broken, not wanting to pay 40 to 50 dollars for the restore disks I just went and borrowed a friends disc reformat It wasn't a full or upgrade, according to me, it was just a restore (a dell one because that's what it says in my computer).

    and basically because of this I can not activate with its original product key, but I got an upgrade to windows 7 but I'm sure he checks for activation, it would be possible to activate and or upgrade with this situation?

    You cannot use a Dell recovery disk on an HP computer.

    Spend the money on the HP recovery disks:

    http://welcome.HP.com/country/us/en/contact_us.html

    Contact your computer manufacturer and ask them to send a recovery disk/s Vista set.

    Normally, they do this for a cost of $ small.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    You can't bring a unactivated Windows 7 Vista!

    For any other question of Windows 7:

    http://social.answers.Microsoft.com/forums/en-us/category/Windows7

    Link above is Windows 7 Forum for questions on Windows 7.

    Windows 7 questions should be directed to the it.

    You are in the Vista Forums.

    See you soon.

    Mick Murphy - Microsoft partner

Maybe you are looking for