Webocreation

Saturday, April 30, 2011

funny songs by sakaira Prank








funny songs by sakaira

Running Competition By Berni funny cartoon







Funny running competition of the berni carton

Wednesday, April 27, 2011

Errors Solved in the CSV import/export of opencart






Dear Rupak

I have a similar error to ialiendre's when I click on the export button:

Error: Table 'opn_j262cjfa6g.product' doesn't exist
Error No: 1146
SELECT * FROM `product` p inner join product_description pd on pd.product_id=p.product_id

Are you able to help me? I'm running v1.4.9.4 .

Thanks & best regards

-=============================================


The tip is that i forget to place the database prefix.

Change the following code

At model/tool/csvproduct.php replace with the codes

$query = "SELECT * FROM `". DB_PREFIX ."" . $table . "` p inner join ". DB_PREFIX ."product_description pd on pd.product_id=p.product_id";

at line no 21 or something like the $query

$query15 = "SELECT * from ". DB_PREFIX ."product_to_category ptc inner join ". DB_PREFIX ."category_description cd on cd.category_id=ptc.category_id where ptc.product_id=". $row['product_id'];

at line number 85 or something like the $query

$sql_query = "INSERT INTO ". DB_PREFIX ."product(product_id,model,quantity,price,list_price,image,stock_status_id,status,weight_class_id, length_class_id) VALUES";
$sql_query1 = "INSERT INTO ". DB_PREFIX ."product_description(product_id,name,description,language_id) VALUES";
$sql_query2 = "INSERT INTO ". DB_PREFIX ."product_to_store (product_id,store_id)VALUES";

at line no 159 to 161 or something like the $query

Thanking You

Best Cycling trick ever done by Berni






funny cartoon of berni, rupak nepali berni

Want to play Golf with the Berni







Watch out how Berni Play golf, one of the most hilarious cartoon on the glof

Decrypt Your code




Want to decrypt the code then visit the site above.
How do i decrypt the php code?
How do i use the decryption of the code?

For all the above question the answer is
Visit the site below:
http://www.region59.net/unlockit/decoder.php

This service is designed to decrypt php-scripts that have been processed by the program SourceCop. Do not use this service to remove the protection to commercial products and for any similar actions which violate the copyright of third parties. Author services shall not be liable for the performance of the decoded scripts, as well as for any damage caused by their use.

Tuesday, April 26, 2011

Php errors: Deprecated: Call-time pass-by-reference has been deprecated and its solution






Got problems with the Notice in the code you can simply remove them by pasting the line below

error_reporting (E_ALL ^ E_NOTICE);

Notice: Use of undefined constant action - assumed 'action' in D:\web\xampp\htdocs\....\....\..\.....php(1) : eval()'d code on line 43



Deprecated: Call-time pass-by-reference has been deprecated

if we get this errors then we just have to change 
allow_call_time_pass_reference = off 
 to

allow_call_time_pass_reference = on


at php.ini file


After this don't forget to restart your xampp or wamp or means server.


Ways to find the php.ini file
Make one file and write <?php echo phpinfo(); ?>

and run it in the browser and search for the word "php.ini"
According to above mine php.ini file is included in the D:\web\xampp\php folders.

By this you will be able to get the php.ini file and change the setting as per your need.

Thanking You
Rupak Nepali

Rupak Nepali Admin Menu Management in Opencart




Rupak Nepali Admin Menu Management in Opencart
Click To Download Rupak Nepali Admin Menu Managment of Opencart 

Unzip the file and copy in the respective folder then it works


The file at the admin/view/template/common/header.tpl is overridden so better to keep the back up of the file if you dont like it you can use the previous one.

If you have performed any changes in the menu then it may not work.


Thanking You
Rupak Nepali

hiding menu when no permission is given, show only the menu which have permission, menu according to the permission given in opencart.

Sunday, April 24, 2011

How to add Special Buttons in the main menu of opencart




I would like to ceate a new button next to the "Home button" on default template. Called "Specials" and then link it to specials offers page.

Any one have any ideas on how to create it as same as the defult colors etc and link it to specials offers page.

I am learning heaps about programming etc.

=========================
Answer:
Remove this from catalog/view/template/common/header.tpl
<div class="div4"><a href="<?php echo str_replace('&', '&amp;', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>
      <?php if (!$logged) { ?>
      <a href="<?php echo str_replace('&', '&amp;', $login); ?>" id="tab_login"><?php echo $text_login; ?></a>
      <?php } else { ?>
      <a href="<?php echo str_replace('&', '&amp;', $logout); ?>" id="tab_logout"><?php echo $text_logout; ?></a>
      <?php } ?>
      <a href="<?php echo str_replace('&', '&amp;', $account); ?>" id="tab_account"><?php echo $text_account; ?></a><a href="<?php echo str_replace('&', '&amp;', $cart); ?>" id="tab_cart"><?php echo $text_cart; ?></a><a href="<?php echo str_replace('&', '&amp;', $checkout); ?>" id="tab_checkout"><?php echo $text_checkout; ?></a></div>

And Paste on the same place the line below
<div class="div4">
    <a href="<?php echo str_replace('&', '&amp;', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>

     <a href="<?php echo str_replace('&', '&amp;', $special); ?>"><?php echo $text_special; ?></a>
      <?php if (!$logged) { ?>
      <a href="<?php echo str_replace('&', '&amp;', $login); ?>" id="tab_login"><?php echo $text_login; ?></a>
      <?php } else { ?>
      <a href="<?php echo str_replace('&', '&amp;', $logout); ?>" id="tab_logout"><?php echo $text_logout; ?></a>
      <?php } ?>
      <a href="<?php echo str_replace('&', '&amp;', $account); ?>" id="tab_account"><?php echo $text_account; ?></a><a href="<?php echo str_replace('&', '&amp;', $cart); ?>" id="tab_cart"><?php echo $text_cart; ?></a>

      </div>

Latest News module for the opencart




Click to download the Latest News Module of opencart
Unzip the files and

Copy and paste the files in their respective folders.
====================================================
FOR BACK END
====================================================
Paste the following

<li><a href="<?php echo  HTTPS_SERVER . 'index.php?route=catalog/news&token=' . $this->session->data['token']; ?>">Latest News</a></li>

in the admin\view\template\common\header.tpl

below these lines

       <li><a href="<?php echo $product; ?>"><?php echo $text_product; ?></a></li>
        <li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
        <li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>
======================================================


Now open in the browser login in the admin

Give permission to the user (You can set the permission by admin only) for catalog/news

admin>> System>> Users>> User Groups>> Then select the user and click edit and check the catalog/news  on both the access permission and the modify permission


======================================================

After that click on the Catalog>> Latest News
======================================================
FOR FRONT END SETTINGS
======================================================
Place "Latest News" by linking with the link
        "index.php?route=information/news"
Now clicking on the link shows the latest news in the desc order
======================================================

Saturday, April 23, 2011

Latest News Extension coming Soon wait until Sunday, April 24, 2011




Latest News Extension coming Soon wait until Sunday, April 24, 2011

I am now working on the Latest News Showing in the Opencart. I have almost completed it and i am checking it so please wait until Sunday, April 24, 2011 after that you will be able to get the latest news module for free in the opencart.

Thanking You all for having patience.

Rupak Nepali

Banner Advertisement management System in the opencart
What i have found is that the banner advertisement management system can be used with my existing slider banner management syste,.

Visit this link http://nepalrupak.blogspot.com/2011/04/sliding-banner-management-code-for.html and you will be able to get the banner management system for the opencart where administrator can easily manage the banner and links that exists.

The 'Banner ADS System' has been designed to allow the administrator to advertise two main types of banner ads, both types can be run side by side from the same admin so double the whammy...

1. LONG BANNER ADS (480X100*): these banners are rotators, the banner one takes up one banner space and rotates every 10 seconds, banners are linkable and have title information (edit via admin). These are set to be displayed at he top of the page (but can be moved manually anywhere).

2. MINI BANNER ADS (160X100*): these are mini ads that appear in a module on the left AND right columns (YES NOW BOTH), these are displayed as a vertical list.

See the workflow images for guidance.

Friday, April 22, 2011

Rupak Nepali Wish-list extension for the Opencart




Wish-list extension for the Opencart

Click To Download The Wishlist of Opencart 

Unzzip the file and place the file to the respective folders.
===================================

But in the product.tpl we have to kep the code by deleting the code below:

  <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>
              <div>
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />               
              </div>

paste the following code:

        <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />    <br />    <br />
                <input name="" onClick="f1.action='index.php?route=checkout/cart'; return true;" type="image" src="catalog/view/theme/candid/image/add-tocart.png" />
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
             
          
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />               
               
               
        <input name="" onClick="f1.action='index.php?route=account/wish_list&product_id=<?php echo $product_id; ?>'; return true;" type="image" src="catalog/view/theme/candid/image/add-to-wishlist.png" />

========================================
The main theme is to give the form name="f1"

Find the below code:


<form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product">

Repalce with

 <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product" name="f1">

=======================================

Hope that the above code workout if it doesnot comment on

http://nepalrupak.blogspot.com

Thanking You for your time to use it.

wishlist module for the opencart, wishlist component for the opencart, opencart wishlist, download wishlist for free opencart, opencart wishlist for free

Thursday, April 21, 2011

Document library functions




Document library functions in the opencart
setTitle($title):
The title of the page is set with the call of $this->document->setTitle($title); where $title is the parameter which take the string.
public function setTitle($title) {
$this->title = $title;
}
getTitle():
$this->document->setTitle() means the title is get and set to <title> of the document
public function getTitle() {
return $this->title;
}
setDescription($description):
$this->document->setDescription($description) which set the description of the page.
public function setDescription($description) {
$this->description = $description;
}
getDescription():
$this->document->getDescription() gives us the description of the document which is embedded in the <head> of the document
public function getDescription() {
return $this->description;
}
setKeywords($keywords):
$this->document->setKeywords($keywords) set the SEO keywords
public function setKeywords($keywords) {
$this->keywords = $keywords;
}
getKeywords():
$this->document->getKeywords() get the keywords which are set for the page.
public function getKeywords() {
return $this->keywords;
}
setBase($base):
$this->document->setBase($base) the base url for the document. If we need different base url then we have to set it.
public function setBase($base) {
$this->base = $base;
}
getBase():
Retrieve the set base url
public function getBase() {
return $this->base;
}
setCharset($charset):
public function setCharset($charset) {
$this->charset = $charset;
}

getCharset():

public function getCharset() {
return $this->charset;
}
setLanguage($language):
public function setLanguage($language) {
$this->language = $language;
}
getLanguage():
public function getLanguage() {
return $this->language;
}
setDirection($direction):
public function setDirection($direction) {
$this->direction = $direction;
}
getDirection():
public function getDirection() {
return $this->direction;
}
addLink($href, $rel):
public function addLink($href, $rel) {
$this->links[] = array(
'href' => $href,
'rel' => $rel
);
}

getLinks():
public function getLinks() {
return $this->links;
}
addStyle($href, $rel = 'stylesheet', $media = 'screen'):
public function addStyle($href, $rel = 'stylesheet', $media = 'screen') {
$this->styles[] = array(
'href' => $href,
'rel' => $rel,
'media' => $media
);
}

getStyles():
public function getStyles() {
return $this->styles;
}

addScript($script):
public function addScript($script) {
$this->scripts[] = $script;
}
getScripts():
public function getScripts() {
return $this->scripts;
}

addBreadcrumb($text, $href, $separator = ' > '):
public function addBreadcrumb($text, $href, $separator = ' > ') {
$this->breadcrumbs[] = array(
'text' => $text,
'href' => $href,
'separator' => $separator
);
}

getBreadcrumbs():
public function getBreadcrumbs() {
return $this->breadcrumbs;
}

Wednesday, April 20, 2011

Rupak Nepali CSV import Export for opencart




Click to Download Rupak Nepali CSV import Export for opencart

Unzip the files and

Copy and paste the files in their respective folders.

  ====================================================

  Paste the following

<li><a href="<?php echo  HTTPS_SERVER . 'index.php?route=tool/csvproduct&token=' . $this->session->data['token']; ?>">Product Category CSV</a></li>

in the admin\view\template\common\header.tpl

below these lines

   

  <li><a href="<?php echo $error_log; ?>"><?php echo $text_error_log; ?></a></li>

  <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>

  ======================================================


Now open in the browser login in the admin

Give permission to the user (You can set the permission by admin only) for tool/csvproduct

admin>> System>> Users>> User Groups>> Then select the user and click edit and check the tool/csvproduct  on both the access permission and the modify permission


======================================================

After that click on the System>> Product Category CSV

======================================================



Sliding Banner Management Code for the opencart.




Click to Download Rupak Slider Banner Management of Opencart

From the downloaded file extract the file with WinRAR archiver and you will be able to get the zip file extracted and then follow the following steps:

Copy and paste the files in their respective folders.

====================================================

Paste the following
<li><a href="<?php echo HTTPS_SERVER . 'index.php?route=catalog/banner&token=' . $this->session->data['token']; ?>">Banner Management</a></li>
in the admin\view\template\common\header.tpl
below these lines



<li id="catalog"><a class="top"><?php echo $text_catalog; ?></a>

<ul>

<li><a href="<?php echo $category; ?>"><?php echo $text_category; ?></a></li>

<li><a href="<?php echo $product; ?>"><?php echo $text_product; ?></a></li>

<li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>

<li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>

<li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>

<li><a href="<?php echo $information; ?>"><?php echo $text_information; ?></a></li>
======================================================
Run the Sql in the "Sql for the database.txt" onto your database.
======================================================
Now open in the browser login in the admin
Give permission to the user (You can set the permission by admin only) for catalog/banner
admin>> System>> Users>> User Groups>> Then select the user and click edit and check the caralog/banner on both the access permission and the modify


permission


======================================================
After that click on the Catalog >> Banner Managment
======================================================
Copy the below code on which you want to show the banner changing

======================================================


<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/slider.css">

<script type="text/javascript" src="catalog/view/theme/default/js/easySlider1.7.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$("#slider").easySlider({

auto: true,

continuous: true,

numeric: true

});

});

</script>




<script type="text/javascript">

function slideSwitch() {

var $active = $('#slideshow IMG.active');



if ( $active.length == 0 ) $active = $('#slideshow IMG:last');



// use this to pull the images in the order they appear in the markup

var $next = $active.next().length ? $active.next()

: $('#slideshow IMG:first');

$active.addClass('last-active');



$next.css({opacity: 0.0})

.addClass('active')

.animate({opacity: 1.0}, 1000, function() {

$active.removeClass('active last-active');

});

}



$(function() {

setInterval( "slideSwitch()", 5000 );

});



</script>
<div id="slider">

<ul>

<?php

$result = mysql_query("SELECT * FROM banner b inner join banner_description bd on bd.banner_id=b.banner_id ");

$i=0;

while($row = mysql_fetch_array($result))

{



?>

<li>

<a href="<?php echo $row['link']; ?>">

<img src="image/<?php echo $row['image']; ?>" alt="" title="<?php echo $row['description']; ?>"/>

</a>

</li>

<?php $i++; }

?>

</ul>

</div>
======================================================

Workout with the css so that you can make as per your choice



Tuesday, April 19, 2011

Shipping Rules/Protocols that can be used




Shipping Rules/Protocols
Customer will have two options for orders under $750 and/or outside LA, OC; three options for orders over $750 who are within LA/OC area, two options for orders over $750 whose ship to address is outside of LA/OC area. We won’t be using UPS’s API since products exceed their dimension limitations.  We’ll be creating an account with ABF - I’m in the process of establishing an account.

RULES:
Order < $750
·         Will Call
·         ABF Carrier  

Order > $750
·         Will Call
·         ABF Carrier
·         Free Local Delivery inside OC/LA

Order > $750 Outside OC/LA
·         Will Call
·         ABF Carrier
·         //Order receives automatic $50 credit in lieu of Free Local Delivery// needs approval..so wait on this, just wanted to give you a headsup

ABF API
·         Utilize combination of ABF Transparent Direct Links: http://www.abfs.com/ecommerce/tlinks/ for backend and frontend integration
o   Bill of LadingBackend only http://www.abfs.com/ecommerce/tlinks/tl_bol.asp?NCHK=SPLM
o   Pick up requestBackend only http://www.abfs.com/ecommerce/tlinks/tl_pickup.asp?NCHK=SPLM
o   Document RetrievalFrontend Customer Account Page http://www.abfs.com/ecommerce/tlinks/tl_docret.asp?NCHK=SPLM
§  Allows customers to retrieve documents associated with shipment by purchase order# or customer reference#
o   Rate QuotationBackend only? Should match rate provided on calculator, if calculator integrates on the frontend I don’t know why we would want to provide another quote option. Seems like potential problems would be too high to justify giving the customer this. http://www.abfs.com/ecommerce/tlinks/tl_aquote.asp?NCHK=SPLM
o   TrackingBackend & Frontend Customer Account Page http://www.abfs.com/ecommerce/tlinks/tl_tracing.asp?NCHK=SPLM
o   Transit Time Request - Backend & Frontend Customer Account Page http://www.abfs.com/ecommerce/tlinks/tl_transit.asp?NCHK=SPLM

·         Front end will use ABF shipping charge calculator on product page, order page: http://www.abfs.com/ecommerce/scc/
Requirement of the clients in the opencart and how I am going to tackle it and develop logic is glittering mind. Hope I will get the solution by brainstorming and searching if anyone who have already work in the abfs I will be very thankful

Collection of Opencart Module




Free opencart Module

download extension

dead cow extension for SEO
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=39962

calculator extension module for opencart

http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=38546


Sliding of brands module

http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=38303

latest product slideshow

http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=38302

You tube Video integration module
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=34422


Rss Feed
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=32809

Module to show module in the tab form

http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=31387

For next and previous sowing of the opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=9767

JQZoom module

http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=29442


Live Help Module
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=29123

Skype module showing is i am online or offline
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=19095

Social networking module for opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=15556

Visitor count module for opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=12487

Lovely and nice manufacturer images showing
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=12237

Stock Reporting module
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=10947

Opencart Export/Import Tools
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=49746


Pdf file uploader
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=47910

Product Attribute Image help in opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=35317

Batch Upload of Images
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=30600

News letter suscribe module for the opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=26033

Options image module for opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=17968

Proof of invoice and packingslip
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=15095


Search Key reporting
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=9595

Category with product count
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=8976

Floating save and continue
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=8976

Iweb extension of opencart in the mobile
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=5221

shipping by weight in opencart module
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=3794


Skype for opencart
http://www.opencart.com/index.php?route=extension/extension/download&extension_download_id=3794

About the configuration class in the opencart




config:
config consists of 5 functions and they are as follows:
get($key):
$this->config->get('welcome_text_position'): is the example that check whether the data is set or not if it is not set then it will return null.
public function get($key) {
return (isset($this->data[$key]) ? $this->data[$key] : NULL);
}
set($key, $value):
This is used to set the value and is done by $this->config->set($key, $value)
public function set($key, $value) {
$this->data[$key] = $value;
}
has($key):
Check whether there is key available or not.
public function has($key) {
return isset($this->data[$key]);
}
load($filename):
This is the function which loads the file that the parameter is passed. If it does not find the file then it will return the error message saying ‘Error: Could not load config filename’
public function load($filename) {
$file = DIR_CONFIG . $filename . '.php';
if (file_exists($file)) {
$cfg = array();
require($file);
$this->data = array_merge($this->data, $cfg);
} else {
exit('Error: Could not load config ' . $filename . '!');
}
}

how to get the configuration class, uses of configuration function and its uses, function on the configuration

About the currency function on the opencart





currency:
set($currency):
Set the currency to be used in overall site.
public function set($currency) {
$this->code = $currency;
if ((!isset($this->session->data['currency'])) || ($this->session->data['currency'] != $currency)) {
$this->session->data['currency'] = $currency;
}
if ((!isset($this->request->cookie['currency'])) || ($this->request->cookie['currency'] != $currency)) {
setcookie('currency', $currency, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
}
format($number, $currency = '', $value = '', $format = TRUE):

public function format($number, $currency = '', $value = '', $format = TRUE) {
if ($currency && $this->has($currency)) {
$symbol_left = $this->currencies[$currency]['symbol_left'];
$symbol_right = $this->currencies[$currency]['symbol_right'];
$decimal_place = $this->currencies[$currency]['decimal_place'];
} else {
$symbol_left = $this->currencies[$this->code]['symbol_left'];
$symbol_right = $this->currencies[$this->code]['symbol_right'];
$decimal_place = $this->currencies[$this->code]['decimal_place'];

$currency = $this->code;
}

if ($value) {
$value = $value;
} else {
$value = $this->currencies[$currency]['value'];
}

if ($value) {
$value = $number * $value;
} else {
$value = $number;
}

$string = '';

if (($symbol_left) && ($format)) {
$string .= $symbol_left;
}

if ($format) {
$decimal_point = $this->language->get('decimal_point');
} else {
$decimal_point = '.';
}

if ($format) {
$thousand_point = $this->language->get('thousand_point');
} else {
$thousand_point = '';
}

$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);

if (($symbol_right) && ($format)) {
$string .= $symbol_right;
}

return $string;
}
convert($value, $from, $to):
Convert the given value from once currency to other. The parameters are $value means of what amount and $from means of which currency and $to mean to which currency is the value to be converted.
public function convert($value, $from, $to) {
if (isset($this->currencies[$from])) {
$from = $this->currencies[$from]['value'];
} else {
$from = 0;
}
if (isset($this->currencies[$to])) {
$to = $this->currencies[$to]['value'];
} else {
$to = 0;
}
return $value * ($to / $from);
}
getId():
Returns the currency ID.
public function getId() {
return $this->currencies[$this->code]['currency_id'];
}
getCode():
Returns the currency code.
public function getCode() {
return $this->code;
}
getValue($currency):
If the currency is set then returns the value nor it will return zero.
public function getValue($currency) {
if (isset($this->currencies[$currency])) {
return $this->currencies[$currency]['value'];
} else {
return 0;
}
}
has($currency):
Whether the request currency is available or not.
public function has($currency) {
return isset($this->currencies[$currency]);
}

currency converting function, currency library function, converting currency function in class of opencart

Collection of customer function and its description in Opencart




customer:
login($email, $password):
Check whether the customer is approved and check whether the username and password is correct or not.
public function login($email, $password) {
if (!$this->config->get('config_customer_approval')) {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
} else {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
}

if ($customer_query->num_rows) {
$this->session->data['customer_id'] = $customer_query->row['customer_id'];

if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
$cart = unserialize($customer_query->row['cart']);

foreach ($cart as $key => $value) {
if (!array_key_exists($key, $this->session->data['cart'])) {
$this->session->data['cart'][$key] = $value;
} else {
$this->session->data['cart'][$key] += $value;
}
}
}

$this->customer_id = $customer_query->row['customer_id'];
$this->firstname = $customer_query->row['firstname'];
$this->lastname = $customer_query->row['lastname'];
$this->email = $customer_query->row['email'];
$this->telephone = $customer_query->row['telephone'];
$this->fax = $customer_query->row['fax'];
$this->newsletter = $customer_query->row['newsletter'];
$this->customer_group_id = $customer_query->row['customer_group_id'];
$this->address_id = $customer_query->row['address_id'];

return TRUE;
} else {
return FALSE;
}
}

logout():
Destroy all the session of the logged customer.
public function logout() {
unset($this->session->data['customer_id']);

$this->customer_id = '';
$this->firstname = '';
$this->lastname = '';
$this->email = '';
$this->telephone = '';
$this->fax = '';
$this->newsletter = '';
$this->customer_group_id = '';
$this->address_id = '';

session_destroy();
}
isLogged():
Check whether the customer is logged in or not.
public function isLogged() {
return $this->customer_id;
}
getId(), getFirstName(), getLastName(), getEmail(), getTelephone(), getFax(), getNewsletter(), getCustomerGroupId(), getAddressId():
Returns the customer information like for ID we have to write $this->customer->getId().
public function getId() {
return $this->customer_id;
}

public function getFirstName() {
return $this->firstname;
}

public function getLastName() {
return $this->lastname;
}

public function getEmail() {
return $this->email;
}

public function getTelephone() {
return $this->telephone;
}

public function getFax() {
return $this->fax;
}

public function getNewsletter() {
return $this->newsletter;
}

public function getCustomerGroupId() {
return $this->customer_group_id;
}

public function getAddressId() {
return $this->address_id;
}

get the customer description with the use of class function

Collection of database function and its description in Opencart





db:
query($sql):
$this->db->query(“Select * from product”); This returns all the product available in the database
public function query($sql) {
return $this->driver->query($sql);
}
escape($value):
public function escape($value) {
return $this->driver->escape($value);
}
countAffected():
public function countAffected() {
return $this->driver->countAffected();
}

getLastId():
Last affected or inserted or deleted Id is returned.
public function getLastId() {
return $this->driver->getLastId();
}

collection of database function and its description in opencart, collection of database functions, function opencart, database library function on the opencart, how to get the latest inserted id of the product?,how to find the last inserted customer id?

Monday, April 18, 2011

Cart in the opencart




Cart:
Functions that are in the cart library of opencart are:
$this->cart->getProducts():
This is the line which is used for getting the products that are in the cart.
public function getProducts() {
$product_data = array();

foreach ($this->session->data['cart'] as $key => $value) {
$array = explode(':', $key);
$product_id = $array[0];
$quantity = $value;
$stock = TRUE;

if (isset($array[1])) {
$options = explode('.', $array[1]);
} else {
$options = array();
}

$product_query = $this->db->query("SELECT *, wcd.unit AS weight_class, mcd.unit AS length_class FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "weight_class wc ON (p.weight_class_id = wc.weight_class_id) LEFT JOIN " . DB_PREFIX . "weight_class_description wcd ON (wc.weight_class_id = wcd.weight_class_id) LEFT JOIN " . DB_PREFIX . "length_class mc ON (p.length_class_id = mc.length_class_id) LEFT JOIN " . DB_PREFIX . "length_class_description mcd ON (mc.length_class_id = mcd.length_class_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'"); if ($product_query->num_rows) {
$option_price = 0;

$option_data = array();

foreach ($options as $product_option_value_id) {
$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "product_option_value_description povd ON (pov.product_option_value_id = povd.product_option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_id = '" . (int)$product_id . "' AND povd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY pov.sort_order");

if ($option_value_query->num_rows) {
$option_query = $this->db->query("SELECT pod.name FROM " . DB_PREFIX . "product_option po LEFT JOIN " . DB_PREFIX . "product_option_description pod ON (po.product_option_id = pod.product_option_id) WHERE po.product_option_id = '" . (int)$option_value_query->row['product_option_id'] . "' AND po.product_id = '" . (int)$product_id . "' AND pod.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY po.sort_order");

if ($option_value_query->row['prefix'] == '+') {
$option_price = $option_price + $option_value_query->row['price'];
} elseif ($option_value_query->row['prefix'] == '-') {
$option_price = $option_price - $option_value_query->row['price'];
}

$option_data[] = array(
'product_option_value_id' => $product_option_value_id,
'name' => $option_query->row['name'],
'value' => $option_value_query->row['name'],
'prefix' => $option_value_query->row['prefix'],
'price' => $option_value_query->row['price']
);

if ($option_value_query->row['subtract'] && (!$option_value_query->row['quantity'] || ($option_value_query->row['quantity'] < $quantity))) { $stock = FALSE; } } } if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}

$discount_quantity = 0;
foreach ($this->session->data['cart'] as $k => $v) {
$array2 = explode(':', $k);
if ($array2[0] == $product_id) {
$discount_quantity += $v;
}
}

$product_discount_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND quantity <= '" . (int)$discount_quantity . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY quantity DESC, priority ASC, price ASC LIMIT 1");

if ($product_discount_query->num_rows) {
$price = $product_discount_query->row['price'];
} else {
$product_special_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");

if ($product_special_query->num_rows) {
$price = $product_special_query->row['price'];
} else {
$price = $product_query->row['price'];
}
}

$download_data = array();

$download_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_download p2d LEFT JOIN " . DB_PREFIX . "download d ON (p2d.download_id = d.download_id) LEFT JOIN " . DB_PREFIX . "download_description dd ON (d.download_id = dd.download_id) WHERE p2d.product_id = '" . (int)$product_id . "' AND dd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

foreach ($download_query->rows as $download) {
$download_data[] = array(
'download_id' => $download['download_id'],
'name' => $download['name'],
'filename' => $download['filename'],
'mask' => $download['mask'],
'remaining' => $download['remaining']
);
}

if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $quantity)) { $stock = FALSE; } $product_data[$key] = array( 'key' => $key,
'product_id' => $product_query->row['product_id'],
'name' => $product_query->row['name'],
'model' => $product_query->row['model'],
'shipping' => $product_query->row['shipping'],
'image' => $product_query->row['image'],
'option' => $option_data,
'download' => $download_data,
'quantity' => $quantity,
'minimum' => $product_query->row['minimum'],
'subtract' => $product_query->row['subtract'],
'stock' => $stock,
'price' => ($price + $option_price),
'total' => ($price + $option_price) * $quantity,
'tax_class_id' => $product_query->row['tax_class_id'],
'weight' => $product_query->row['weight'],
'weight_class' => $product_query->row['weight_class'],
'length' => $product_query->row['length'],
'width' => $product_query->row['width'],
'height' => $product_query->row['height'],
'length_class' => $product_query->row['length_class']
);
} else {
$this->remove($key);
}
}

return $product_data;
}
$this->cart->add($product_id, $qty = 1, $options = array()):
By this we are able to add product in the cart. Actually in the cart the products’ Id and the requested quantity and the options of the product is stored in the array.
public function add($product_id, $qty = 1, $options = array()) {
if (!$options) {
$key = $product_id;
} else {
$key = $product_id . ':' . implode('.', $options);
}

if ((int)$qty && ((int)$qty > 0)) {
if (!isset($this->session->data['cart'][$key])) {
$this->session->data['cart'][$key] = (int)$qty;
} else {
$this->session->data['cart'][$key] += (int)$qty;
}
}
$this->setMinQty();
}
$this->cart->update($key, $qty):
By this we update the product quantity in the cart. So the parameters that we need are the product id and the quantity amount.
public function update($key, $qty) {
if ((int)$qty && ((int)$qty > 0)) {
$this->session->data['cart'][$key] = (int)$qty;
} else {
$this->remove($key);
}
$this->setMinQty();
}
$this->cart->remove($key):
Remove the product from the cart and the parameter that it take is the product id and the product with the product is deleted from the cart.
public function remove($key) {
if (isset($this->session->data['cart'][$key])) {
unset($this->session->data['cart'][$key]);
}
}
$this->cart->clear():
Clear all the product from the cart or cart is empty
public function clear() {
$this->session->data['cart'] = array();
}
$this->cart->getWeight():
This function returns the weight of the cart means the total weight of the products in the cart.
public function getWeight() {
$weight = 0;

foreach ($this->getProducts() as $product) {
if ($product['shipping']) {
$weight += $this->weight->convert($product['weight'] * $product['quantity'], $product['weight_class'], $this->config->get('config_weight_class'));
}
}
return $weight;
}
$this->cart->setMinQty():
public function setMinQty() {
foreach ($this->getProducts() as $product) {
if ($product['quantity'] < $product['minimum']) { $this->session->data['cart'][$product['key']] = $product['minimum'];
}
}
}
$this->cart->getSubTotal():
Returns the sub total of the cart.
public function getSubTotal() {
$total = 0;
foreach ($this->getProducts() as $product) {
$total += $product['total'];
}
return $total;
}
$this->cart->getTaxes():
Returns the total taxes that is applicable to the cart’s products
public function getTaxes() {
$taxes = array();

foreach ($this->getProducts() as $product) {
if ($product['tax_class_id']) {
if (!isset($taxes[$product['tax_class_id']])) {
$taxes[$product['tax_class_id']] = $product['total'] / 100 * $this->tax->getRate($product['tax_class_id']);
} else {
$taxes[$product['tax_class_id']] += $product['total'] / 100 * $this->tax->getRate($product['tax_class_id']);
}
}
}

return $taxes;
}
$this->cart->getTotal():
Returns the total cost of the cart.
public function getTotal() {
$total = 0;
foreach ($this->getProducts() as $product) {
$total += $this->tax->calculate($product['total'], $product['tax_class_id'], $this->config->get('config_tax'));
}
return $total;
}
$this->cart->countProducts():
Returns the total number of the product in the cart
public function countProducts() {
return array_sum($this->session->data['cart']);
}
$this->cart->hasProducts():
Checks whether there is product in the cart or not.
public function hasProducts() {
return count($this->session->data['cart']);
}
$this->cart->hasStock():
Checks whether there is stock for the product in the cart or not.
public function hasStock() {
$stock = TRUE;

foreach ($this->getProducts() as $product) {
if (!$product['stock']) {
$stock = FALSE;
}
}

return $stock;
}
$this->cart->hasShipping():
Checks whether the cart contains the shipping address or not.
public function hasShipping() {
$shipping = FALSE;

foreach ($this->getProducts() as $product) {
if ($product['shipping']) {
$shipping = TRUE;

break;
}
}
return $shipping;
}
$this->cart->hasDownload():
This is useful for the downloadable products and checks whether it is downloadable or custom product
public function hasDownload() {
$download = FALSE;
foreach ($this->getProducts() as $product) {
if ($product['download']) {
$download = TRUE;
break;
}
}
return $download;
}

description of the function in opencart,uses of the cart function, ways to make the cart functions work properly in the opencart, cart functions desciption

Captcha in the Opencart




Captcha:
How to load the captcha:

In the controller we have to insert the code:
public function captcha() {
$this->load->library('captcha');
$captcha = new Captcha();
$this->session->data['captcha'] = $captcha->getCode();
$captcha->showImage();
}
In the template file:




Captcha contains only two function and they are below:
getCode():
This will generate the code that will be displayed in the image of the captcha.
function getCode(){
return $this->code;
}
And showImage():
This will generate the image with the code to show the captcha in the front end.

function showImage() {
$image = imagecreatetruecolor($this->height, $this->width);

$width = imagesx($image);
$height = imagesy($image);

$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocatealpha($image, 255, 0, 0, 75);
$green = imagecolorallocatealpha($image, 0, 255, 0, 75);
$blue = imagecolorallocatealpha($image, 0, 0, 255, 75);

imagefilledrectangle($image, 0, 0, $width, $height, $white);

imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $red);
imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $green);
imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $blue);

imagefilledrectangle($image, 0, 0, $width, 0, $black);
imagefilledrectangle($image, $width - 1, 0, $width - 1, $height - 1, $black);
imagefilledrectangle($image, 0, 0, 0, $height - 1, $black);
imagefilledrectangle($image, 0, $height - 1, $width, $height - 1, $black);

imagestring($image, 10, intval(($width - (strlen($this->code) * 9)) / 2), intval(($height - 15) / 2), $this->code, $black);

header('Content-type: image/jpeg');

imagejpeg($image);

imagedestroy($image);
}

captcha in the opencart, how to use captcha in the opencart, functions of captcha in the opencat, the easitest way to use captcha, functions for the captcha, how to change the image in the captcha, ways to learn captcha

Opencart Cache library function




Opencart Cache library function:
Calling of the cache function from the controller or view or model
$this->cache->get($key);
This is useful to get the caches that are enabled.
The get function in the library is defined as follows:
public function get($key) {
$files = glob(DIR_CACHE . 'cache.' . $key . '.*');
if ($files) {
foreach ($files as $file) {
$handle = fopen($file, 'r');
$cache = fread($handle, filesize($file));
fclose($handle);
return unserialize($cache);
}
}
}
$this->cache->set($key, $value):
This is useful to enable the cache.
The function set is defined as below:
public function set($key, $value) {
$this->delete($key);
$file = DIR_CACHE . 'cache.' . $key . '.' . (time() + $this->expire);
$handle = fopen($file, 'w');
fwrite($handle, serialize($value));
fclose($handle);
}

$this->cache->delete($key):
This is useful to delete the cache by which we can enable the next cache by setting.
The function delete defined as follows:
public function delete($key) {
$files = glob(DIR_CACHE . 'cache.' . $key . '.*');
if ($files) {
foreach ($files as $file) {
if (file_exists($file)) {
unlink($file);
clearstatcache();
}
}
}
}

opencart function collections, funtion collection of opencart, opencart by example, learn opencart by function and example

Sunday, April 17, 2011

Time to change the word that we speak






Friends it's time to change the words.
Let me give example:
If son wants to take a high costing training then
If father says "I can't afford it." Then it is statement which stop peple to think.
But if he says "How can I afford it?" Then it is question by which the son start to think or activate the mind.

Collection of library function in the opencart by Rupak Nepali




These are the library name that we can get in the opencart
cache, captcha, cart, config, currency, customer, db, document, encryption, image, json, language, length, log, mail, pagination, request, response, session, tax, template, user, weight
How we can use the library:
$this->cache->function_name_available();
List of function name in the respective category:
Cache:
    $this->cache->get($key);
    $this->cache->set($key, $value):
    $this->cache->delete($key):

Captcha:
Captcha contains only two function and they are below:
getCode():
showImage():

Cart:
Functions that are in the cart library of opencart are:
$this->cart->getProducts():
add($product_id, $qty = 1, $options = array()):
update($key, $qty):
remove($key):
clear():
getWeight():
setMinQty():
getSubTotal():
getTaxes():
getTotal():
countProducts():
hasProducts():
hasStock():
hasShipping():
hasDownload():

config:
config consists of 5 functions and they are as follows:
get($key):
set($key, $value):
has($key):
load($filename):

currency:
set($currency):
format($number, $currency = '', $value = '', $format = TRUE):
convert($value, $from, $to):
getId():
getCode():
getValue($currency):
has($currency):

customer:
login($email, $password):
logout():
isLogged():
getId():
getFirstName():
getLastName():
getEmail():
getTelephone():
getFax():
getNewsletter():
getCustomerGroupId():
getAddressId():

db:
query($sql):
escape($value):
countAffected():
getLastId():

document:
setTitle($title):
getTitle():
setDescription($description):
getDescription():
setKeywords($keywords):
getKeywords():
setBase($base):
getBase():
setCharset($charset):
getCharset():
setLanguage($language):
getLanguage():
setDirection($direction):
getDirection():
addLink($href, $rel):
getLinks():
addStyle($href, $rel = 'stylesheet', $media = 'screen'):
getStyles():
addScript($script):
getScripts():
addBreadcrumb($text, $href, $separator = ' > '):
getBreadcrumbs():

encryption:
encrypt($value):
base64_encode()
decrypt($value):

image:
create($image):
save($file, $quality = 100):
resize($width = 0, $height = 0):
watermark($file, $position = 'bottomright'):
crop($top_x, $top_y, $bottom_x, $bottom_y):
rotate($degree, $color = 'FFFFFF'):
filter($filter):
text($text, $x = 0, $y = 0, $size = 5, $color = '000000'):
merge($file, $x = 0, $y = 0, $opacity = 100):
html2rgb($color):

Json:
encode($data):
decode($json, $assoc = FALSE):

Language:

get($key):
load($filename):

Length:
convert($value, $from, $to):
format($value, $unit, $decimal_point = '.', $thousand_point = ','):


log:
write($message):

Mail:
setTo($to):
setFrom($from):
addheader($header, $value):
setSender($sender):
setSubject($subject):
setText($text):
setHtml($html):
addAttachment($file, $filename = ''):
send():

Pagination:
render():

Request:
clean($data):

Response:
addHeader($header):
redirect($url):
setOutput($output, $level = 0):
compress($data, $level = 0):
output():

Session:
$this->session:

Tax:
setZone($country_id, $zone_id):
calculate($value, $tax_class_id, $calculate = TRUE):
getRate($tax_class_id):
getDescription($tax_class_id):
has($tax_class_id):

Template:
fetch($filename):

User:
login($username, $password):
logout():
hasPermission($key, $value):
isLogged():
getId():
getUserName():

Weight:
convert($value, $from, $to):
format($value, $unit, $decimal_point = '.', $thousand_point = ','):