header ad

Saturday, August 11, 2018

In stock or Out of stock label on Opencart Category page

This tutorial help you to add stock status on your Opencart category page. This guide test with Opencart 3.0.2.0



















Edit stylesheet.css

Open \opencart\catalog\view\theme\default\stylesheet\stylesheet.css

add following code in last line

.stock_label
{
width: auto; height:auto; display:inline-block;
padding:2px 5px 2px 5px;
background:#000;
font-size:12px; color:#FFF; font-weight:600;
}



Edit Category.php controller file

Open \opencart\catalog\controller\product\category.php

Find following code

$data['products'][] = array(
'product_id'  => $result['product_id'],
'thumb'       => $image,
'name'        => $result['name'],
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
'price'       => $price,
'special'     => $special,
'tax'         => $tax,
'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating'      => $result['rating'],
'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);


Replace this code with following


////// Stock Status ////////
if ($result['quantity'] <= 0) {
$stock_status = $result['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$stock_status = $result['quantity'];
} else {
$stock_status = 'In Stock';
}
////// End Stock Status ////////


$data['products'][] = array(
'product_id'  => $result['product_id'],
'thumb'       => $image,
'name'        => $result['name'],
'stock_status'=> $stock_status,  // Stock Status
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
'price'       => $price,
'special'     => $special,
'tax'         => $tax,
'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating'      => $result['rating'],
'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);


Edit category.twig file

Open \opencart\catalog\view\theme\default\template\product\category.twig

Find following line

<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>


after above line add following line

<div class="stock_label">{{ product.stock_status }}</div>


Now your scripts are ready to show stock status but you should refresh in admin panel

How to do it?
  1. Go to admin panel dashboard
  2. You can see "Setting icon" under Logut button (I checked with desktop version)
  3. CLick it
  4. Now popup will open
  5. In the popup you can see action field with refresh icon
  6. Click it in both rows

Live character counter with Jquery

In this post you can learn how to do live character or letter counter in Jquery. It's simple and you can understand quickly. Use our Jquery live character or letter counter for your web development work.








Javascript/Jquery code


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function(e) {
 
$("#enter_title").keyup(function(){

var enter_title = $(this).val();
var enter_title_length = enter_title.length;

$("#enter_title_counter").text(enter_title_length);

});

});

</script>


HTML Code


<label for="enter_title">Enter Title</label>
<input type="text" id="enter_title" />
<div id="enter_title_counter"></div>


HTML/Jquery Code


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function(e) {
 
$("#enter_title").keyup(function(){

var enter_title = $(this).val();
var enter_title_length = enter_title.length;

$("#enter_title_counter").text(enter_title_length);

});

});

</script>
</head>

<body>

<label for="enter_title">Enter Title</label><br />
<input type="text" id="enter_title" /><br />
<div id="enter_title_counter"></div>


</body>
</html>

Prevent browser caching of AJAX call result

$.ajax({
    method: "GET",
    url: "/Home/AddProduct?",
    data: { param1: value1, param2: value2},
    cache: false,
    'Cache-Control': 'no-cache, no-store, must-revalidate',
    'Pragma': 'no-cache',
    'Expires': '0'
     success: function (result) {
        // TODO
    } 
});


How would I find the user-agent from the http requests which were made to my website?

Questions:

  1. When users make requests to our website where is the information from our http request header stored?
  2. Can you access the user-agent from this (for example googlebot)[Would this be done with a serverside language like ruby/php?]
Answer

The user agent is an optional header for the http request your website receives. It's not necessarily 'stored' anywhere after the web request is complete. Depending on the logging on your web server, it may be part of the access log, or it may not be included in that log. If you haven't been logging or collecting the user agent headers, you don't have any way of getting them from requests that are already complete, but you can always start logging them now.

This header, like all the http headers, would be available to any server side script that was passed the request headers (I don't know of any server side that doesn't passed the headers one way or another), so the answer to your second question is, yes.

Wednesday, August 8, 2018

How to Find a spam script location with Exim - VPS / Dedicated Server

I this tutorial I'll guide you how to check the Exis mail log on your VPS or Dedicated server using command. This will help you to find spammers script location in the server, or their own in order to relay spam from your server.

What happen when sending spam mails from server?

When your IP sending spam mails from server can damage the sending reputation of your mail IP address, and lead to issues such as making you end up on a blacklist.

How do I stop spam coming from my server?

Exim, or the MTA (Mail Transfer Agent) on your server handles email deliveries. All email activity is logged including mail sent from scripts. It does this by logging the current working directory from where the script was executed. Using this knowledge you can easily track down a script of your own that is being exploited to send out spam, or locate possibly malicious scripts that a spammer has placed onto your server.

Locate top scripts sending into Exim

01. Login to your server via SSH as the root user.

02. Run the following command to pull the most used mailing script's location from the Exim mail log:
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n

03. You will get back something like this:
15 /home/userna5/public_html/about-us 25 /home/userna5/public_html 7866 /home/userna5/public_html/data

We can see /home/userna5/public_html/data by far has more deliveries coming in than any others.

Sunday, June 29, 2014

Web Design Sri Lanka

Web Design Sri Lanka 

Web Design Sri Lanka

Webivox is a Professional Web Design Company in Sri Lanka. We have more than 4 years of experience in Web Design Sri Lanka, CMS Web Design Sri Lanka, Ecommerce web design Sri Lanka, Catalog web design Sri Lanka and other web related services. Our Web Design services are closely touch with latest technologies, free 1 year web hosting and domain registration. You can check our web design portfolio using this link http://www.webivox.com/our-work. We are not only design and host your website. We can promote your website through Social Media, SEO, Adword and etc as your request. At our web development company Sri Lanka, We have latest techniques such as HTML5 Web Design, PHP Web Development, MAGENTO Web Design, JOOMLA Web Design, WORDPRESS Web Design, DRUPAL Web Design and etc. Our Web Design Sri Lanka services always come with full customer satisfaction.
















Friday, March 7, 2014

How to enable mcrypt on localhost (Appserv)

01. Go to C:\AppServ\php5\
02. Copy libmcrypt.dll to C:\AppServ\php5\ext\ and C:\Windows\System32
03. Open PHP.in file (C:\Windows\php.ini)
04. Find ;extension=php_mcrypt.dll and replace extension=php_mcrypt.dll
05. Restart your Appserv

Web Design Sri Lanka + Web Hosting Sri lanka  + Web Design portfolio