hello to all i am new to web making can any body tell me how i make my site by using opencart like this web site http://whatmobile.com.pk/ please help me i an so thankful to all.
Last edited by i2Paq on Tue Oct 26, 2010 3:43 am, edited 1 time in total.
Reason: Topic moved
Reason: Topic moved
Of couse...gsmorbit wrote:bro thanks for help but i cont understand that language because i understand English Language. kindly guide me in English thanks
step 1.open and edit home.php(catalog/controller/common/home.php)
Code: Select all
<?php
class ControllerCommonHome extends Controller {
public function index() {
$this->language->load('common/home');
$this->load->model('tool/seo_url');
$this->document->title = $this->config->get('config_title');
$this->document->description = $this->config->get('config_meta_description');
$this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));
$this->load->model('setting/store');
if (!$this->config->get('config_store_id')) {
$this->data['welcome'] = html_entity_decode($this->config->get('config_description_' . $this->config->get('config_language_id')), ENT_QUOTES, 'UTF-8');
} else {
$store_info = $this->model_setting_store->getStore($this->config->get('config_store_id'));
if ($store_info) {
$this->data['welcome'] = html_entity_decode($store_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$this->data['welcome'] = '';
}
}
$this->data['text_allproduct'] = $this->language->get('text_allproduct');//This line is optional.
$this->data['productsbycats'] = $this->getLatestProductsCategories();//productbycats will cal fn getLatestProductsCategories();
$this->data['allproduct'] = HTTPS_SERVER . 'index.php?route=product/allproducts';//This line is optional.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/home.tpl';
} else {
$this->template = 'default/template/common/home.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->load->model('checkout/extension');
$module_data = $this->model_checkout_extension->getExtensionsByPosition('module', 'home');
$this->data['modules'] = $module_data;
foreach ($module_data as $result) {
$this->children[] = 'module/' . $result['code'];
}
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
/////////creat function for call all category///////////////////
public function getLatestProductsCategories(){
$this->load->model('catalog/product');
$this->load->model('tool/image');
$this->load->model('tool/seo_url');
$this->load->model('catalog/category');
$this->load->model('catalog/review');
$output = '';
if (!$this->config->get('config_customer_price')) {
$display_price = TRUE;
} elseif ($this->customer->isLogged()) {
$display_price = TRUE;
} else {
$display_price = FALSE;
}
$results1 = $this->model_catalog_category->getCategories(0);
foreach ($results1 as $result1) {
$output .= '<div class="top">
<div class="left"></div>
<div class="right"></div>
<div class="center"><h1>' . $result1['name'] . '</h1></div></div>';
$output .= '<div class="middle">
<table class="list"><tr>';
$results = $this->model_catalog_product->getProductsByCategoryId($result1['category_id'],$sort = 'p.sort_order', $order = 'ASC', $start = 0, $limit = 4);//Chang 4 to other that u want
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
$special = FALSE;
$discount = $this->model_catalog_product->getProductDiscount($result['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
$href = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']);
$thumb = $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
$stars = sprintf($this->language->get('text_stars'), $rating);
$output .= '<td style="width: 25%;">';
if (isset($result)) {
$output .= '<a href="' . $href . '"><img src="' . $thumb . '" title="' . $result['name'] . '" alt="' . $result['name'] . '" /></a><br />';
$output .= '<a href="' . $href . '">' . $result['name'] . '</a><br />';
$output .= '<span style="color: #999; font-size: 11px;">' . $result['model'] . '</span><br />';
if ($display_price) {
if (!$special) {
$output .= '<span style="color: #900; font-weight: bold;">' . $price . '</span><br />';
} else {
$output .= '<span style="color: #900; font-weight: bold; text-decoration: line-through;">' . $price . '</span> <span style="color: #F00;">' . $special . '</span>';
}
}
}
if ($result['rating']) {
$output .= '<img src="catalog/view/theme/default/image/stars_' . $rating . '.png" alt="' . $stars . '" />';
}
$output .= '</td>';
}
$output .= '</tr></table>';
$output .= '<div style="text-align: right;"><a href="index.php?route=product/category&path=' . $result1['category_id'] . '"><img src="catalog/view/theme/default/image/more2.gif" alt="more" title="More"/></a></div><br />';
$output .='</div><div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>';
}
return $output;
}
////end function getallcategory///////
///<img src="catalog/view/theme/default/image/more2.gif" alt="more" title="More"/> u can change this image to other
}
?>
Code: Select all
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content">
<?php if ($welcome) { ?>
<div class="top">
<div class="left"></div>
<div class="right"></div>
<div class="center">
<h1><?php echo $heading_title; ?></h1>
</div>
</div>
<div class="middle">
<div><?php echo $welcome; ?></div>
</div>
<div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
<?php } ?>
<?php foreach ($modules as $module) { ?>
<?php echo ${$module['code']}; ?>
<?php } ?>
<?php echo $productsbycats; ?><!--Get all category-->
</div>
<?php echo $footer; ?>
ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step
Who is online
Users browsing this forum: No registered users and 15 guests