Post by mulunix » Fri Jul 02, 2010 11:52 am

hallo teman2 gw tanya lagi ini
untuk menampilkan berat barang di halaman utama produk kekmana ?
Misalnya

Code: Select all

Harga :  	 Rp 15.350.000,00-
Stok : 	997
Model : 	SONY7009
Rating Rata-rata : 	Not Rated 
Berat :     20 Kg
thanks


maaf gw banyak kali nanyaknya ...........

Image


User avatar
Active Member

Posts

Joined
Mon Jun 21, 2010 4:56 am

Post by bebaspromo » Sat Jul 03, 2010 6:23 am

Baru bisa nampilkan Beratnya aja, belum bisa melakukan penampakan satuan berat ...
jadi cuma nampak 30 (misal) aja, Kg-nya belum ...
mungkin Bro Qahar bisa bantu?

untuk 1.4.8b tentunya ...

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by mulunix » Sat Jul 03, 2010 7:10 am

waktu kita klik View Cart baru nampak berat barang nya

waktu kita klik nama barang seperti dibawah ini
Harga : Rp1.000,00
Stok : 9
Model : Product 21
Merk : Hewlett-Packard
Rating Rata-rata :
Berat :30 Kg <==== agar muncul berat barang kekmana ?


thanks bro dah kasih saran :good:

Image


User avatar
Active Member

Posts

Joined
Mon Jun 21, 2010 4:56 am

Post by bebaspromo » Sat Jul 03, 2010 7:17 am

coba utak atik di sana
postingan lawas, sih ...
tapi ya itu tadi ... muncul weight: 50 .... Kgnya belum berhasil. ;D

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by mulunix » Sat Jul 03, 2010 7:27 am

kek nya bro Qahar bisa masalah yg kekni

kita tunggu bro Qahar aja :ponder:

Image


User avatar
Active Member

Posts

Joined
Mon Jun 21, 2010 4:56 am

Post by bebaspromo » Sat Jul 03, 2010 8:46 am

Panggilan...panggilan.... ditujukan buat siapa aja, khususnya Bung Qahar .... ;)

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by superbrands » Sat Jul 03, 2010 10:31 am

Harus mengubah proses query database untuk fungsi: public function getProduct($product_id) di file model product.php dulu, bro. Query-nya di JOIN-kan lagi dengan table weight_class_description. Baru kemudian variable-variablenya didefinisikan di controllernya.

"For us, OpenCart is not 'just' a shopping cart. OpenCart is bigger than that. We bring OpenCart to the next level."

Produk:
- Toko Online - Toko Online Dropshipper - Toko Online Marketpace - Online Directory - Digital Marketplace - Property & Business Listings - News Portal - Corporate Website - Social Network

Info: http://www.bukausahaonline.com


User avatar
Active Member

Posts

Joined
Sun May 23, 2010 8:04 pm

Post by qahar » Sat Jul 03, 2010 4:31 pm

bebaspromo wrote:Panggilan...panggilan.... ditujukan buat siapa aja, khususnya Bung Qahar .... ;)
kalo nanya gimana ganti gambar bisa boz, ni aja lagi nyari function yg dimili openCart.
nah itu dah di jawab ma bro Superbrand. kayaknya blajar dari dia bakal maknyus nih..

OOT: ada yg minta bantuan saya bikin drop down kategori lho, dia pake theme default2 he3.. ntar klo dah slesai, saya kabari ato jgn mlah saya ntar ga dibayar.. :laugh:

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by bebaspromo » Sat Jul 03, 2010 4:34 pm

superbrands wrote:Harus mengubah proses query database untuk fungsi: public function getProduct($product_id) di file model product.php dulu, bro. Query-nya di JOIN-kan lagi dengan table weight_class_description. Baru kemudian variable-variablenya didefinisikan di controllernya.
asli! nggak ngeh .... :drunk:

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by bebaspromo » Sat Jul 03, 2010 4:35 pm

qahar wrote: OOT: ada yg minta bantuan saya bikin drop down kategori lho, dia pake theme default2 he3.. ntar klo dah slesai, saya kabari ato jgn mlah saya ntar ga dibayar.. :laugh:
dulu pernah bisa .... tapi lupa ???

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by mulunix » Sat Jul 03, 2010 6:20 pm

superbrands wrote:Harus mengubah proses query database untuk fungsi: public function getProduct($product_id) di file model product.php dulu, bro. Query-nya di JOIN-kan lagi dengan table weight_class_description. Baru kemudian variable-variablenya didefinisikan di controllernya.
wah ka gak ngarti gw yg kek ginian ???

Image


User avatar
Active Member

Posts

Joined
Mon Jun 21, 2010 4:56 am

Post by cevarief » Sat Jul 03, 2010 6:44 pm

bebaspromo wrote:
superbrands wrote:Harus mengubah proses query database untuk fungsi: public function getProduct($product_id) di file model product.php dulu, bro. Query-nya di JOIN-kan lagi dengan table weight_class_description. Baru kemudian variable-variablenya didefinisikan di controllernya.
asli! nggak ngeh .... :drunk:
Maksudnya pada saat data product dibaca dari database, opencart tidak mengambil data satuan yang berada di tabel weight_class_description. Nah untuk itu kode untuk mengambil data ke databasenya harus dimodifikasi. Kodenya ada di file model/product.php

Coba ganti function getProduct (awas tanpa s dibelakang) pada file model diatas
public function getProduct($product_id) {
$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, w.title FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN " . DB_PREFIX . "weight_class_description AS w USING (weight_class_id) WHERE p.product_id = '" . (int) $product_id . "' AND pd.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int) $this->config->get('config_store_id') . "' AND ss.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");
return $query->row;
}
Baris yang dibold pada code adalah modifikasinya.

Selanjutnya, di file controller/product/product.php bisa Anda keluarkan data satuan tsb dengan variabel $product_info['title'] dalam kondisi if ($product_info) {}, sekitar baris 80-an.

Active Member

Posts

Joined
Wed Jun 02, 2010 10:52 pm

Post by qahar » Sat Jul 03, 2010 6:49 pm

makasih gan, bisa di coba nih.. ;)

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by bebaspromo » Sat Jul 03, 2010 7:01 pm

matur tengkiu Bro cevarief,
turut mencoba sambil mengernyitkan dahi dan garuk2 kepala ....

lebih mangtabz, kalau yg di product/product.php nya diberi contohnya sekalian ;D Ngarep Mode = ON ....

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by mulunix » Sat Jul 03, 2010 7:14 pm

cevarief wrote:
bebaspromo wrote:
superbrands wrote:Harus mengubah proses query database untuk fungsi: public function getProduct($product_id) di file model product.php dulu, bro. Query-nya di JOIN-kan lagi dengan table weight_class_description. Baru kemudian variable-variablenya didefinisikan di controllernya.
asli! nggak ngeh .... :drunk:
Maksudnya pada saat data product dibaca dari database, opencart tidak mengambil data satuan yang berada di tabel weight_class_description. Nah untuk itu kode untuk mengambil data ke databasenya harus dimodifikasi. Kodenya ada di file model/product.php

Coba ganti function getProduct (awas tanpa s dibelakang) pada file model diatas
public function getProduct($product_id) {
$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, w.title FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN " . DB_PREFIX . "weight_class_description AS w USING (weight_class_id) WHERE p.product_id = '" . (int) $product_id . "' AND pd.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int) $this->config->get('config_store_id') . "' AND ss.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");
return $query->row;
}
Baris yang dibold pada code adalah modifikasinya.

Selanjutnya, di file controller/product/product.php bisa Anda keluarkan data satuan tsb dengan variabel $product_info['title'] dalam kondisi if ($product_info) {}, sekitar baris 80-an.
detilnya bro .
gw awam banget ni liat code2 yg kek ginian

Image


User avatar
Active Member

Posts

Joined
Mon Jun 21, 2010 4:56 am

Post by cevarief » Sat Jul 03, 2010 7:31 pm

detilnya bro .
gw awam banget ni liat code2 yg kek ginian
Detail apanya ? code itu ya detailnya yang harus diubah :P yang dikasi bold. Tinggal replace aja satu block fungsi itu

Active Member

Posts

Joined
Wed Jun 02, 2010 10:52 pm

Post by bebaspromo » Sat Jul 03, 2010 8:02 pm

cevarief wrote: Selanjutnya, di file controller/product/product.php bisa Anda keluarkan data satuan tsb dengan variabel $product_info['title'] dalam kondisi if ($product_info) {}, sekitar baris 80-an.
detail yang ininya, mungkin?

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by cevarief » Sat Jul 03, 2010 11:42 pm

Ini saya revise stepnya untuk menampilkan berat dan satuan, sekalian mau saya gunakan untuk project yang sedang saya garap :D

Hasil yang diinginkan adalah property product Weight: 1.5 Kilogram

Ada 4 file yang harus dimodifikasi yaitu : controller product, model product, language product dan template product.

1. File controller/product/product.php
a. Sisipkan baris text weight di baris 138

Code: Select all

$this->data['text_weight'] = $this->language->get('text_weight');
b. Sisipkan berat dan satuan di baris 240

Code: Select all

$this->data['weight'] = $product_info['weight']; //berat
$this->data['weight_title'] = $product_info['title']; //satuan
2. model/catalog/product.php
Ganti satu block public function getProduct($product_id) di awal-awal baris file tsb menjadi :

Code: Select all

public function getProduct($product_id) {
        $query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, w.title FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN " . DB_PREFIX . "weight_class_description AS w USING (weight_class_id) WHERE p.product_id = '" . (int) $product_id . "' AND pd.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int) $this->config->get('config_store_id') . "' AND ss.language_id = '" . (int) $this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");
        return $query->row;
}
3. language/folderbahasa/product/product.php
Tambahkan di baris 8 atau bebas untuk text berat. Sesuaikan dengan bahasa yang digunakan.

Code: Select all

$_['text_weight']         = 'Satuan:'; 
4. view/theme/namatemplate/template/product.product.tpl
Sisipkan kode berikut untuk menampilkan berat. Sesuiakan dimana ingin menampilkannya. Misal sebelum text manufacturer pada baris 38.

Code: Select all

<tr>
                <td><b><?php echo $text_weight; ?></b></td>
                <td><?php echo $weight . ' ' . $weight_title; ?></td>
</tr>
Hasil bisa dilihat diattahment.

Watch this : Hacking OC code is a nightmare after upgrading to a newer version later :laugh: :laugh: :laugh:

Attachments

weight.jpg

weight.jpg (10.46 KiB) Viewed 8962 times

Last edited by cevarief on Sun Jul 04, 2010 8:26 am, edited 3 times in total.

Active Member

Posts

Joined
Wed Jun 02, 2010 10:52 pm

Post by bebaspromo » Sun Jul 04, 2010 5:38 am

Siappp, Bro cevarief!
Ntar habis mata ini melek lagi akan segera mencoba dan melaporkannya ...

thanks b4 :)

User avatar
Active Member

Posts

Joined
Tue Dec 22, 2009 9:14 pm

Post by cevarief » Sun Jul 04, 2010 9:30 am

UPDATED!

Active Member

Posts

Joined
Wed Jun 02, 2010 10:52 pm
Who is online

Users browsing this forum: No registered users and 11 guests