Showing posts with label Osclass. Show all posts
Showing posts with label Osclass. Show all posts

Tuesday, November 3, 2015

Bạn muốn thiết kế một website bán hàng, bạn muôn thêm một bản đồ việt nam hay vùng bạn muốn kinh doanh sản phẩm vào website của mình . Hôm nay minh văn hướng dẫn các bạn thêm bản đồ vào website của mình giống bên chợ tốt nhe.


Đầu tiên để có một bản đồ , bạn có thể chọn một trong số các theme miễn phí của OSclass, bạn có thể tải về ở đây   Theme đã tích hợp bản đồ bạn tải về tại đây

Tải file sample_map.zip về 
Kiếm cho mình một bản đồ việt nam.
Tải phần mềm Macromedia Dreamweaver

Xem video hướng dẫn bên dưới




Monday, October 26, 2015

Để sản phẩm của bạn tự động đăng lên facebook, khi bạn cần giới thiệu sản phẩm với mọi người..trong OSclass bạn có thể tham khảo theo cách sau.

 thêm thẻ meta vào trong file item.php 

<meta property="og:title" content="Whatever title" />
<meta property="og:description" content="description of your site"/>


VD: Trong file ITEM.PHP


<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta property="fb:app_id" content="YOUR FB APP ID HERE" /> 
<meta property="og:type"   content="website" />  
<meta property="og:url" content="<?php echo osc_item_url() ; ?>" />
<meta property="og:title" content="<?php echo osc_item_title(); ?>" />
<meta property="og:image" content="<?php echo osc_resource_url(); ?>" />


Trong file MAIN.PHP


<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
<meta property="fb:app_id" content="YOUR FB APP ID" /> 
<meta property="og:type"   content="website" />  
<meta property="og:url" content="http://www.yoursite.com/" />
<meta property="og:title" content="what ever you like, can be different from general settings in your admin panel" />
<meta property="og:description" content="what ever you like"/>
<meta property="og:image" content="http://your_logo_at_least_200x200.jpg" />


và cuối cùng là thừa hưởng thành quả thôi

Thursday, August 6, 2015

Mặc định Osclass không hiển thị số điện thoại để liên hệ khách hàng hôm nay mình sẽ giới thiệu cho các bạn cách thêm số điện thoại vào trang bán hàng của bạn với mã nguồn Osclass.




Bước 1: bạn hãy tìm file struct.sql  theo đường dẫn sau : oc-include/osclass/installer/struct.sql

Nhấn Ctrl + F rồi tìm bảng t_item


CREATE TABLE /*TABLE_PREFIX*/t_item (
    pk_i_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    fk_i_user_id INT(10) UNSIGNED NULL,
    fk_i_category_id INT(10) UNSIGNED NOT NULL,
    dt_pub_date DATETIME NOT NULL,
    dt_mod_date DATETIME NULL,
    f_price FLOAT NULL,
    i_price BIGINT(20) NULL,
    fk_c_currency_code CHAR(3) NULL,
    s_contact_name VARCHAR(100) NULL,
    s_contact_email VARCHAR(140) NULL,
    s_contact_phone VARCHAR(45) NULL,        <------------ thêm đoạn này vào
    s_ip VARCHAR(64) NOT NULL DEFAULT '',
    b_premium TINYINT(1) NOT NULL DEFAULT 0,
    b_enabled TINYINT(1) NOT NULL DEFAULT 1,
    b_active TINYINT(1) NOT NULL DEFAULT 0,
    b_spam TINYINT(1) NOT NULL DEFAULT 0,
    s_secret VARCHAR(40) NULL,
    b_show_email TINYINT(1) NULL,
    dt_expiration datetime NOT NULL DEFAULT '9999-12-31 23:59:59',

Bước 2: mở file item.php theo đường dẫn: oc-includes/osclass/model/item.php

tìm dòng 's_contact_email', và thêm vào sau nó 's_contact_phone',
function __construct()
        {
            parent::__construct();
            $this->setTableName('t_item');
            $this->setPrimaryKey('pk_i_id');
            $array_fields = array(
                'pk_i_id',
                'fk_i_user_id',
                'fk_i_category_id',
                'dt_pub_date',
                'dt_mod_date',
                'f_price',
                'i_price',
                'fk_c_currency_code',
                's_contact_name',
                's_contact_email',
                's_contact_phone', <---------------- thêm dòng này vào
                'b_premium',
                's_ip',
                'b_enabled',
                'b_active',
                'b_spam',
                's_secret',
                'b_show_email',
                'dt_expiration'
            );
            $this->setFields($array_fields);
        }
Bước 3: mở file hitems.php đường dẫn như sau: oc-includes/osclass/helpers/hitems.php
các bạn thêm hàm sau vào nhé
function osc_item_contact_phone() {
        return (string) osc_item_field("s_contact_phone");
    }
Bước4: mở file hpremium.php đường dẫn như sau: oc-

includes/osclass/helpers/hpremium.php


các bạn thêm hàm sau vào nhé

function osc_premium_contact_phone() {
        return (string) osc_premium_field("s_contact_phone");
    }
các bạn thêm hai hàm trên vào dưới hàm osc_premium_contact_email()

Bước5: mở file ItemActions.php đường dẫ như sau: oc-includes/osclass/ItemActions.php


Tìm đoạn mã sau

$contactName       = strip_tags( trim( $aItem['contactName'] ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );
Và thay thế bằng đoạn mã sau
$contactName       = strip_tags( trim( $aItem['contactName'] ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
            $contactPhone      = strip_tags( trim( $aItem['contactPhone'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );
tiếp theo cũng trong file ItemActions.php 
các bạn tìm đoạn code 
$this->manager->insert(array(
                    'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => $enabled,
                    'b_show_email'          => $aItem['showEmail'],
                    'b_spam'                => $is_spam,
                    's_ip'                  => $aItem['s_ip']
                ));
và thay thế bằng đoạn code trên bằng 

$this->manager->insert(array(
                    'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
                    's_contact_phone'       => $contactPhone,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => $enabled,
                    'b_show_email'          => $aItem['showEmail'],
                    'b_spam'                => $is_spam,
                    's_ip'                  => $aItem['s_ip']
                ));

tìm đoạn code 
$_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");
thêm vào bên dưới đoạn code
$flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
            
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");
Tìm đoạn code 
if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];
                } else {
                    $aItem['userId']      = NULL;
                }
Thay thế bằng đoạn code sau
if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];
                    $aItem['contactPhone'] = ($user['s_phone_mobile'])? $user['s_phone_mobile'] : $user['s_phone_land'];
                } else {
                    $aItem['userId']      = NULL;
                }
Tìm đoạn code
if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }
và Thay thế bằng đoạn code sau
if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                    $aUpdate['s_contact_phone'] = $aItem['contactPhone'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }
 Tìm dòng code
if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
            }
Và thay thế bằng đoạn code sau
if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                $aItem['contactPhone']  = ($data['s_phone_mobile'])? $data['s_phone_mobile'] : $data['s_phone_land'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
                Params::setParam('contactPhone', ($data['s_phone_mobile'])? $data['s_phone_mobile'] : $data['s_phone_land']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
                $aItem['contactPhone']  = Params::getParam('contactPhone');
            }
Bước6:  mở file item.form.class.php như đường dẫn sau: oc-includes/osclass/frm/item.form.class.php 

Tìm đoạn code

static public function contact_email_text($item = null) {
            if($item==null) { $item = osc_item(); };
            if( Session::newInstance()->_getForm('contactEmail') != "" ) {
                $item['s_contact_email'] = Session::newInstance()->_getForm('contactEmail');
            }
            parent::generic_input_text('contactEmail', (isset($item['s_contact_email'])) ? $item['s_contact_email'] : null);
            return true;
        }
thêm vào bên dưới đoạn code.
static public function contact_phone_text($item = null) {
    if($item==null) { $item = osc_item(); };
    if( Session::newInstance()->_getForm('contactPhone') != "" ) {
        $item['s_contact_phone'] = Session::newInstance()->_getForm('contactPhone');
    }
   parent::generic_input_text('contactPhone', (isset($item['s_contact_phone'])) ? $item['s_contact_phone'] : null);
    return true;
}
Bước7:  chúng ta sẽ cho nó hiển thị ra ngoài trang chủ và trang sidebar
Các bạn tìm file item-sidebar.php như đường dẫn sau: oc-content/themes/bender/item-sidebar.php

mở file này ra và tìm đoạn code

<h2> <?php _e ( "Contact publisher" , 'bender' ); ?> </h2> 
<p class="name"> <?php echo osc_item_contact_name (); ?> <p>
Các bạn thêm vào dưới đoạn code sau
$phoneuser = osc_item_contact_phone(); 
    if ($phoneuser != "") { ?> 
    <p>Phone: <?php echo $phoneuser ; ?> </p> 
<?php } ?>
Tiếp tục tìm file item-post.php như đường dẫn: oc-content/themes/bender/item-post.php

Mở file này lên các bạn tìm tới dòng code

<div class="control-group"> 
    <label class="control-label" for="contactEmail"> <?php _e 'E-mail' 'bender' ); ?> </label> 
    <div class="controls"> 
<?php ItemForm :: contact_email_text (); ?> 
    </div> 
</div>
và thêm vào bên dưới đoạn code sau
<div class="control-group"> 
    <label class="control-label" for="contactPhone"> <?php _e ( 'Phone' , 'bender' ); ?> </label> 
<div class="controls"> 
<?php ItemForm :: contact_phone_text (); ?> 
    </div> 
</div>
 Tiếp tục mở file frm.php đường dẫn sauoc-admin/themes/modern/items/frm.php

Tìm đoạn code 

<div class="input-has-placeholder input-separate-top"> 
    <label> <?php _e 'E-mail' ); ?> </label> 
<?php ItemForm :: contact_email_text (); ?> 
</div>
và thêm vào dưới nó đoạn code sau
<?php if( osc_item_user_id () == null ) { ?> 
<div class="input-has-placeholder input-separate-top"> 
    <label> <?php _e ( 'Phone' ); ?> </label> 
<?php ItemForm :: contact_phone_text (); ?> 
</div> 
<?php } ?>
Như vậy là các bạn đã thêm xong file điện thoại vào trang web của mình rồi
Lưu ý: những dòng code màu đỏ là những code các bạn thêm vào mã nguồn của bạn.
các bạn có thể xem thêm cách cài đặt tại đây
Cách việt hóa ngôn ngữ tại đây.
Chúc các bạn thành công!

Saturday, July 18, 2015

Trong giao diện của mã nguồn sẽ có riêng một tập tin ngôn ngữ nằm trong thư mục languages ( ví dụ: /oc-content/themes/modern/languages/.... ). Sẽ có ít nhất hai tập tin  theme.po và theme.mo , đó là những cái file chính. Cũng có thể có thêm các tập tin, chẳng hạn như messages.po và messages.mo .

chúng ta tìm file .po trong thư mục /oc-content/themes/ theme của bạn/languages/.... và tiến hành việt hóa.

Nội dung
Bước 1: Tải Poedit

Tải Poedit và cài đặt

Bước 2: Tải về tập tin theme.po của bạn
Để chỉnh sửa file theme.po , trước tiên bạn phải tạo một bản sao của nó vào một thư mục nào đó.

Bước 3: Chạy Poedit
Chạy Poedit và sau đó nhấp vào tập tin và mở theme.po .sẽ như hình bên dưới
Bây giờ bạn sẽ thấy một danh sách các chuỗi, cùng với hai ngang khung cửa sổ riêng biệt xuống ở dưới cùng của chương trình, như thế này:



Bước 4: Chỉnh sửa
Để chỉnh sửa một chuỗi, trong Phần chưa việt hóa , click vào 1 chuỗi bạn muốn chỉnh sửa. Sau đó bạn sẽ thấy chuỗi xuất hiện ở Source text phần này bạn không nên chỉnh sửa  (điều này cũng sẽ yêu cầu chỉnh sửa các file php theme của bạn). Sau đó, hãy nhấp vào khung Translation và gõ văn bản mà bạn muốn xuất hiện để thay thế.

Bạn có thể tiếp tục chỉnh sửa các chuỗi bằng cách lặp lại các thủ tục trên. Một khi bạn đã hoàn tất việc chỉnh sửa, nhấp vào file > Save .

chương trình sẽ tự động tạo một file mới có tên theme.mo . Tập tin này sẽ xuất hiện trong cùng một vị trí trên máy tính  như theme.po .

Bước 5: Upload lên website
Cuối cùng, bây giờ bạn tải lên tập tin  theme.mo  vào thư mục ngôn ngữ của theme , thay thế   file theme.mo cũ. Bạn không cần phải tải lên các tập tin .po, nhưng bạn có thể nếu bạn muốn. Chỉ có file .mo là thực sự được sử dụng bởi Osclass.


Giờ bạn hãy truy cập vào trang để thưởng thức thôi nào!.

Văn Phòng

Nơi chia sẻ cho bạn kiến thức về lĩnh vực Văn Phòng cơ bản nhất bao gồm Word, Excel, PowerPoint...

Mã Nguồn Website

Nơi chia sẻ cho bạn kiến thức về lĩnh vực Mã Nguồn Mở Website thông dụng nhất bao gồm Blog, Wordpress,Joomla,OSClass, NukeViệt...

Thủ Thuật SEO

Nơi chia sẻ cho bạn kiến thức về lĩnh vực SEO cơ bản nhất bao gồm Mạng xã hội, Blog, Website, Google...

Kiếm Tiền Online

Nơi chia sẻ cho bạn kiến thức về lĩnh vực Kiếm Tiền Online cơ bản nhất bao gồm Tiếp thị liên kết, đặt quảng cáo, viết blog, website...

Bài mới

Internet

Nơi chia sẻ cho bạn kiến thức cơ bản về lĩnh vực Internet như; Mạng xã hội, Blog, Website...

Tin Công Nghệ

Cập nhập tin tức mới nhất về lĩnh vực công nghệ như; Điện thoại, Máy tính...