I'm creating a comment system where users can answer to an existent comment but i want to know how to indent those replies ("child" comment) under the existent comment ("parent" comment).
Here current code:
<h2>Fiche</h2>
<?php
$_SESSION['cf']['message'] = $_GET['message'];
$reponse = db_query('SELECT * FROM messages WHERE id = ?', array($_SESSION['cf']['message']));
$donneesmsg = $reponse->fetch()
?>
<h5><?php echo $donneesmsg['Pseudo']; ?></h5>
<p class="text-center text-align"><?php echo $donneesmsg['Message']; ?></p>
Repondre
<?php
echo '<h4>Commentaires</h4>';
echo '<hr>';
$reponse1 = db_query('SELECT * FROM comment WHERE messages_id = ?', array($donneesmsg['id']));
$donneescom1 = $reponse1->fetch();
$reponse = db_query('SELECT * FROM comment WHERE messages_id = ? ORDER BY id ASC', array($donneesmsg['id']));
while ($donneescom = $reponse->fetch()) {
if ($donneescom['commentaires_id'] == 0)
{
echo '<center>';
echo '' .$donneescom['id']. '<br>';
echo '' .$donneescom['pseudo']. '<br>';
echo '' .$donneescom['commentaire']. '<br>';
echo 'Repondre';
echo '<hr>';
echo '</center>';
}
if ($donneescom['commentaires_id'] != 0)
{
echo 'En reponse au com ' .$donneescom['commentaires_id']. '<br>';
echo '' .$donneescom['id']. '<br>';
echo '' .$donneescom['pseudo']. '<br>';
echo '' .$donneescom['commentaire']. '<br>';
echo 'Repondre';
echo '<hr>';
}
}
?>
<form id="formcom" method="post" action="index.php?page=addcomment">
Pseudo: <input type="text" placeholder="Pseudo" name="pseudo"> <br>
Mail: <input type="email" placeholder="Mail" name="mail"> <br>
Commentaire: <textarea placeholder="Commentaire" name="commentaire"></textarea> <br>
<input type="hidden" name="date" value="<?php echo time(); ?>"><br>
<input type="hidden" name="messages_id" value="<?php echo $donneesmsg['id']; ?>"><br>
<input type="text" name="commentaires_id" value="<?php echo $_GET['com']; ?>"><br>
<input type="hidden" name="id" value="<?php echo $donneesmsg['id']; ?>"><br>
<input type="submit" value="Envoyer">
</form>
Related
Is it possible to adjust / remove entry fields on registration page?
Image:
In admin panel go to Customer > Custom Field
Here you can add any custom field you want. Just check Required before saving new field, and enable it. After that you will see it in your registration page.
Removing unnecessary field, like Fax
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group">
<label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
<div class="col-sm-10">
<input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-fax" class="form-control" />
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="fax" value="" />
Removing necessary field, like Address
Do everything from the previous chapter
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-address-1"><?php echo $entry_address_1; ?></label>
<div class="col-sm-10">
<input type="text" name="address_1" value="<?php echo $address_1; ?>" placeholder="<?php echo $entry_address_1; ?>" id="input-address-1" class="form-control" />
<?php if ($error_address_1) { ?>
<div class="text-danger"><?php echo $error_address_1; ?></div>
<?php } ?>
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="address_1" value="" />
Now open catalog/controller/account/register.php
Find private function validate() {, Inside of this function we can see all validations.
Look for
if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
$this->error['address_1'] = $this->language->get('error_address_1');
}
and remove (or comment) it.
I am getting this error:
Parse error: syntax error, unexpected '>' in
C:\xampp\htdocs\jagan\display.php on line 40
Here is my code:
<html>
<head><title> Display Student Results </title></head>
<body>
<form action="display.php method="post">
<table>
<tr>
<td>Enter Hallticket Number:
<td><input type="number" name="hno">
</tr>
<tr>
<td><input type="submit" name="btnsearch" value="search">
</tr>
</table>
</form>
</body>
</html>
<?php
$conn=mysqli_connect("localhost","root","")or die("unable to connect");
mysqli_select_db($conn,"college");
if(isset($_POST['btnsearch']))
{
$hall=$_POST['hno'];
$result=mysqli_connect($conn,"select * from student where hno=$hall");
echo "<h1> Student Results </h1>";
echo "<table border=5>";
echo "<tr>";
echo "<th> hallticket";
echo "<th> Name";
echo "<th> class";
echo "<th> gst";
echo "<th> Tax";
echo "<th> php";
echo "<th> dmdw";
echo "<th> accounts";
echo "</tr>;
while($rows=mysqli_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".rows['hno'];
echo "<td>".rows['name'];
echo "<td>".rows['class'];
echo "<td>".rows['gst'];
echo "<td>".rows['tax'];
echo "<td>".rows['php'];
echo "<td>".rows['dmdw'];
echo "<td>".rows['acc'];
echo "</tr>";
}
echo "</table>";
}
?>
You aren't calling the mysql resultset properly, it's "row" not "rows". Here are the docs.
echo "<td>".rows['hno'];
Should be:
echo "<td>".row['hno'];
Also, your HTML table isn't properly formed. Take a look at this resource to understand how to create a table.
You need to close off your <th> and <td> tags like this:
echo "<th>Name</th>";
Here is a great tutorial that will walk you through PHP/MySQL coding. Working your way through that first will mean less trips here to SO seeking help.
I have an Opencart store with multiple languages. Banners can contain only one picture (irrespective of the language chosen), i designed banner for each language.
Opencart v 2.3.0.2
catalog/./view/theme/default/template/extension/module/banner.tpl
<div id="banner<?php echo $module; ?>" class="owl-carousel">
<?php foreach ($banners as $banner) { ?>
<div class="item">
<?php if ($banner['link']) { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" class="img-responsive" />
<?php } else { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" class="img-responsive" />
<?php } ?>
</div>
<?php } ?>
</div>
You'd have to manage the banner image files manually (with FTP) but an approach like this could work:
For each banner you want to display, upload it as usual in admin.
In the directory where the image is saved, create subdirectories corresponding to the languages you support (for example, "en-gb").
This code assumes banners are under catalog/demo/banners. So it just adds the path "language_name" under that.
Modify catalog/./view/theme/default/template/extension/module/banner.tpl to look first in the language specific subdirectory in the block where it displays the banner. In 2.3.0.2, this would look something like:
<?php
foreach ($banners as $banner) {
$lang = $this->registry->get('language');
if (file_exists($lang . "/" . $banner['image'])) {
$banner['image'] = str_replace("catalog/demo/banners", "catalog/demo/banners/$lang", $banner['image']);
}
}
?>
<div id="banner<?php echo $module; ?>" class="owl-carousel">
<?php foreach ($banners as $banner) { ?>
<div class="item">
<?php if ($banner['link']) { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" class="img-responsive" />
<?php } else { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" class="img-responsive" />
<?php } ?>
</div>
<?php } ?>
</div>
I created a extra tab and custom design for related products in products page. I want to get product name,price and to add to cart,image in a loop. In related product tab check this url I am working on that http://efurnish.co.uk/index.php?route=product/product&path=86&product_id=58
<div class="product-related box">
<div class="box-heading"><span><?php echo $tab_related; ?> (<?php echo count($products); ?>)</span></div>
<div class="box-content products-block">
<?php foreach ($pr
oducts as $i => $product) { $i=$i+1; ?>
<?php if( $i%$cols == 1 && $cols > 1 ) { ?>
<div class="row product-related row-product">
<?php } ?>
<div class="col-lg-<?php echo $span;?>">
<div class="product-block">
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>"
title="<?php echo $product['name']; ?>"
alt="<?php echo $product['name']; ?>"/></a>
</div>
<?php } ?>
<div class="name"><?php echo $product['name']; ?></div>
<div class="group-item">
<?php if ($product['rating']) { ?>
<div class="rating"><img
src="catalog/view/theme/<?php echo $this->config->get('config_template');?>/image/stars-<?php echo $product['rating']; ?>.png"
alt="<?php echo $product['reviews']; ?>"/></div>
<?php } ?>
<div class="price-cart">
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span
class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<div class="cart">
<input type="button" value="<?php echo $button_cart; ?>"
onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"/>
</div>
</div>
</div>
<span class="wishlist"><a class="icon-heart" onclick="addToWishList('<?php echo $product_id; ?>');" data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $button_wishlist; ?>"><span><?php echo $button_wishlist; ?></a></span></span>
<span class="compare"><a class="icon-retweet" onclick="addToCompare('<?php echo $product_id; ?>');" data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $button_compare; ?>"><span><?php echo $button_compare; ?></a></span></span>
</div>
</div>
<?php if( $cols > 1 && ($i%$cols == 0 || $i==count($products)) ) { ?>
</div>
<?php } ?>
I am using this design http://bootsnipp.com/snippets/featured/store-product-layout
There is an option for related products in the product form in the admin panel. You can add related product there to show in the product tab.
To Add Related Products to a product:
In OpenCart admin panel navigate to Catalog -> Products
Search for the product you would like to add related products. Click
Edit link to edit it.
Choose Link tab and scroll down until you see the "Related Products" field.
Start typing a product name in that field and OpenCart will drop
down a list of products that start with whatever letters you have
typed in.
Click on the product you want to add as a related product. You will
see it added to the box below.
Repeat step 4-5 for others product you want to add.
Click on save button
Related products will be added to your product page.
i want to add an option with select control about send mail to customer or not when admin add new order or edit the existing order. and i have trouble with using API.
i added this :
<div class="form-group">
<label class="col-sm-2 control-label" for="input-mailcontrol"><?php echo $entry_email; ?><span data-toggle="tooltip" title="<?php echo $button_shipping; ?>" data-loading-text="<?php echo $text_loading; ?>" </span></label>
<div class="col-sm-10">
<select name="mailcontrol" id="input-mailcontrol" class="form-control">
<?php if ($mailcontrol) { ?>
<option value="1" selected="selected"><?php echo $text_enabled; ?></option>
<option value="0"><?php echo $text_disabled; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_enabled; ?></option>
<option value="0" selected="selected"><?php echo $text_disabled; ?></option>
<?php } ?>
</select>
</div>
</div>
and also these:
$('#tab-customer input[name=\'mailcontrol\']').val(item['mailcontrol']);
and i added everywhere that i see the customer fields.
but still i can not reach that data on the api side. always having same error about there is no such data.
thank you for your helps.
i solved problem with custom fields, i added radio controls with custom fields and checked this custom fields about send mail or not send.
catalog-model-checkout line 605.
$mail_control=$this->db->query("SELECT * from order where order_id='".(int)$order_id."'");
foreach($mail_control->rows as $m){
$t=$m['custom_field'];}
if (!$this->model_payment_amazon_checkout->isAmazonOrder($order_info['order_id']) && strpos($t,"3")){ // 3= custom_field_id