How can I get the products into dolibarr website

I used a default template in dolibarr and I want to show products in website’s products ?

Start with: HTML editing and dynamic content. Next add:

<?php echo "====TEST $db connect===="; $sql = "SELECT * FROM `llx_product`"; $resql = $db->query($sql); $nbtotalofrecords = ''; $nbtotalofrecords = $db->num_rows($resql); $num = $nbtotalofrecords; echo "hello world! My products! #".$num ?>

So what about if I want to fetch image or linkedfiles because linkedfiles or image not available in products table

You can take this code as sample. Still have some work todo, but maybe this gives you an idea.
I took the user part and converted tot product.
product_website.txt (2.7 KB)

so what about the image. do you know how to add a product’s image because it’s not listed in the database table

That is the part I still have to figure out.
Anyone?

from searching I figure out you do that using API and use /document but still has a lot of problems

Interesting topic and useful, thanks!

Any updates displaying product and its images in the website?

Have a look at this thread

Didn’t work, I have Dolibarr 14.0.4

I have also v14 and it works try my code below

<div class="page">

    <?php includeContainer('header'); ?>

      <section id="sectionimage" contenteditable="true">
        <div class="">
          <div class="swiper-wrapper text-center" style="transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;">
            <div class="swiper-slide swiper-slide-active" style="height: 200px; background-image: url('medias/image/WEBSITE/background_sunset.jpg'); background-size: cover;">
              <div class="swiper-slide-caption">
                <div class="container">
                  <div class="row justify-content-sm-center">
                    <div class="col-md-11 col-lg-10">
                      <div class="text-white text-uppercase jumbotron-custom border-modern fadeInUp animated" data-caption-animate="fadeInUp" data-caption-delay="0s">Services</span>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
        </div>
      </section>
        <section id="sectionnews" contenteditable="true" class="section-50 section-md-50 section-md-bottom-50">
                    <div class="container">
                        <div class="text-align: center">
                            <?php 
                            include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
                            include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
                            $websitepage = new WebsitePage($db);
                            $fproduct = new product($db);
                            $arrayofproducts = array();
                            $MAXNB=999;
                            $sql='SELECT rowid FROM '.MAIN_DB_PREFIX.'product LIMIT '.$MAXNB;
                            $resql = $db->query($sql);
                            if (! $resql) dol_print_error($db);
                            while ($obj = $db->fetch_object($resql))
                                {
                                $arrayofproducts[]=$obj->rowid;
                                }
                            print '<div class="row justify-content-sm-center row-40">';
                            foreach($arrayofproducts as $id)
                                {
                                $fproduct->fetch($id);
                                print '<div class="col-sm-8 col-md-7 col-lg-4">';
                                print '<div class="container blog-box d-xl-inline-block" style="padding: 20px; box-shadow: -1px 0px 10px 0px rgba(65, 65, 65, 0.12); transition: .3s all ease;">';
                                print '<div class="post-boxed-img-wrap" style="height: 164px">';

                    		    print '<td class="tdoverflowmax200">';
			                    //print $fproduct->getNomUrl(1); the url to dolibarr
                                $tmpphoto = $fproduct->show_photos('product', $conf->product->multidir_output[$fproduct->entity], 1, 1, 0, 0, 0, 160);
                                if ($fproduct->nbphoto > 0) 
                                    { 
                    				print '<br>'.$tmpphoto;
                                    }
                                else print '<img class="img-circle" src="/viewimage.php?modulepart=medias&amp;file=image/Oldenburger_Automatisering/daviddoe.png" width="129" height="129" alt="">';
                                print '</div>';
                                print '<div class="post-boxed-caption">';
                                print '<div class="post-boxed-title font-weight-bold">'.$fproduct->ref.'</div>';
                                print '<ul class="list-inline list-inline-dashed text-uppercase">';
                            //  print '<li>September 24, 2018</li>';
                                if ($fproduct->price) print '<li><span class="text-primary">'.$fproduct->price.' CHF</span></li>';
                                else print '<li>no price</li>';
                                print '</ul>';
                                print '</div>';
                                print '</div>';
                                print '</div>';
                                }
                            print '</div>';
                            ?>
                        </div>
                    </div>
            </section>

        <section id="sectionfooterdolibarr" contenteditable="true" class="footerdolibarr">
            <div style="margin: 50px"><div class="text-align: center">
<br>
<br>
<br>
This is a description page of our service S...<br>
<br>
<br>
<br>
<br>
            </div></div>
        </section>


    <br><br>

    <?php includeContainer('footer'); ?>

</div>

Hi,
I am starting out by creating a front end for our customers through a website, which we plan on building on the ERP Database.
We reached out to multiple developers, but all have failed even to understand the scope and requirements. Finally, we are doing what we should have done a while ago, we are developing this on our own now!

Any inputs to jump-start would be appreciated. If you have code and you can provide that, even at a cost, we would appreciate the help.