Đây là một component hoàn chỉnh với chức năng, thêm xóa sửa sản phẩm, show sản phẩm và cho phép đặt hàng, kiểm tra đơn hàng.....
Vì là dạng nâng cao nên được chia thành nhiều phần, mỗi phần tiếp theo sẽ được cập nhật ngay tài bài viết này.
File thực hành: http://www.mediafire.com/?kl4067yrb7pco9m
Phần 1: Back-end MVC
Phần 2: Xây dựng form views products
Phần 3: Các tác vụ controller, models, xử lý introtext và fulltext
Phần 4: Sử dụng section và category từ com_content và tooltip image
Phần 5: Front-end tooltip kết hợp Jquery
Phần 6: Sử dụng Ajax để tạo giỏ hàng
Phần 7: Hiển thị giỏ hàng, cập nhật số lượng và xóa sản phẩm
E làm giống a mà file default ko hiện sản phẩm gì hết, trong khi đó CSDL đã có. E nghi lỗi nằm trong 2 file này:
ReplyDeleteFIle model:
function getList($conf){
$sql = "SELECT p.*,u.username AS editor FROM #__carts_products AS p
LEFT Join #__users AS u ON u.id=h.checked_out
ORDER BY ".$conf['order']." ".$conf['order_Dir'] ;
return $this->_getList($sql,$conf['limitstart'],$conf['limit']);
}
function getTotal(){
$this->_db->setQuery("SELECT count(id) FROM #__carts_products");
return $this->_db->loadResult();
}
Fiel view.html.php
function getList(){
global $mainframe;
$conf['order'] = $mainframe->getUserStateFromRequest('com_carts.products.filter_order','filter_order','p.id','string');
$conf['order_Dir'] = $mainframe->getUserStateFromRequest('com_carts.products.filter_order_Dir','filter_order_Dir','ASC','string');
$conf['limitstart'] = $mainframe->getUserStateFromRequest('com_carts.products.limitstart','limitstart',0,'int');
$conf['limit'] = $mainframe->getUserStateFromRequest('com_carts.products.limit','limit',$mainframe->getCfg('list_limit'),'int');
$model = & $this->getModel();
$list = $model->getList($conf);
$this->rows=$list;
jimport('joomla.html.pagination');
$total = $model->getTotal();
$pan = new JPagination($total,$conf['limitstart'],$conf['limit']);
$this->pan=$pan;
}
E tìm hoài , thấy giống a hoàn toàn, kể cả fiel default mà nó ko xuất dữ liệu ra. A giúp e vơi
LEFT Join #__users AS u ON u.id=h.checked_out : p.checked_out nha bạn,
ReplyDeleteSữa rùi a, nó cũng ko hiện lun,nó rơi vào cuối vài 3 của a đó, khi dữ liệu có trong CSD mà ở ngoiaf defaul thì ko hiện. Qua bìa 4 thì a chỉnh gì nó hiện đó, và e có thêm : $this->conf=$conf; để qua layout dùng , nhưng mà cũng bó tay.
DeleteBạn đã có hidden filter_order và filter_order_Dir chưa, bạn có thể send code của bạn qua email để tôi kiểm tra xem
ReplyDeletechúc bạn học tốt
Bạn đã có hidden filter_order và filter_order_Dir chưa, bạn có thể send code của bạn qua email để tôi kiểm tra xem
ReplyDeletechúc bạn học tốt
xin lỗi, e là sinh viên hutech lun, nhưng lại ko có mail a. a cho e mail đi, a có thể share source bài này để tiện vừa xem vừa hiểu đc ko a. tránh trường hợp sai ko biết chổ sữa như thế này.
ReplyDeletea cho em mail đi a?
ReplyDeletee đã có 2 trường ẩn trong defaul rùi:
Deletetype="hidden" name="filter_order" value="conf['order']; ?>"
type="hidden" name="filter_order_Dir" value="conf['odir']; ?>"
Mà cũng bó tay lun. E mò hoài ko ra , chán thiệt.help me với a ơi.
giophuongxa@gmail.com
DeleteE đã gửi thư, a xem giúp e nhé,Thanks a trước
DeleteE mất cả ngày vì nó ko hiện dữ liệu lên default,đến giờ e vẫn mò chưa ra,:)). E đã gửi thư, mong a rãnh khi nào thì sữa giúp e sớm, để e đi tiếp và tiếp tục tìm hiểu hết các video clip của a.Vì nó rất hay.^^
ReplyDelete$conf['order'] = $mainframe->getUserStateFromRequest('com_carts.products.order','filter_order','p.id','string');
Delete$conf['order_Dir'] = $mainframe->getUserStateFromRequest('com_carts.products.order_Dir','filter_order_Dir','ASC','string');
Nha bạn
filter_order và filter_order_Dir nha bạn
Chổ đó ban đầu có chữ filter, sau vì nó ko chạy e thử xóa đi, giờ e thêm vào, mà nó vẫn ko chạy a à.E có gửi a source, a sữa chổ đó , test có chạy ko a??
DeleteMà a có thể share source của a về bài này ko? e bó tay cái source của e rùi, e thấy nó giống a 99% lun mà nó ko hiện dữ liệu trên default, bùn ghê gớm a ơi, giúp e với
Chào bạn!
Deletefunction getList() trong model bạn sữa lại:
$sql = "SELECT p.*,u.username,u2.username AS editor FROM #__carts_products AS p
LEFT Join #__users AS u2 ON u2.id=p.created_by
LEFT Join #__users AS u ON u.id=p.checked_out
ORDER BY " . $conf['order'] . " " . $conf['order_Dir'];
Trong layout default: bạn sữa $this->pan->getrowsOffset($i) thành $this->pan->getRowOffset($i).
file view.html.php, sữa 2 dòng: $conf['order'] = $mainframe->getUserStateFromRequest('com_carts.products.order', 'filter_order', 'p.id', 'string');
$conf['order_Dir'] = $mainframe->getUserStateFromRequest('com_carts.products.order_Dir', 'filter_order_Dir', 'ASC', 'string');
chúc bạn học tốt!
code e nó có sữa được ho a?
ReplyDeleteSữa rồi đó bạn!
Deletechưa xem nhưng cũng thank trước ^^
ReplyDeletea ơi cho em xin cái com_carts này được không , code e làm theo video a hướng dẫn mà vẫn báo lỗi . cho e xin cái code về e tự ngâm cứu đi
ReplyDeleteChào anh. Anh có thể cho em xin cái com này được không. Tại vì em cũng làm theo nhưng đôi khi video mờ quá nên cũng rất hạn chế. Mong anh thông cảm. có thể gửi com này qua mail em cũng được : namtrum999999@gmail.com
ReplyDeleteCảm ơn anh.
Chào Anh Vũ Mai!
ReplyDeleteEm làm đến video thứ 3. Khi click vào các button JToolbarHelper (save, edit, cancel) thì bị lỗi này.
Fatal error: Call to a member function checkin() on a non-object in C:\AppServ\www\joomla\administrator\components\com_carts\models\products.php on line 47
Mong Anh sửa giúp Em. Em cảm ơn nhiều!
hello please help me
ReplyDeleteorder panel error
Warning: Invalid argument supplied for foreach() in /home1/ayhaner/public_html/deryakitabevi.com.tr/administrator/components/com_vshop/views/order/tmpl/edit.php on line 145
Hi Kedi!
DeleteYou have the old version of vshopping cart (2.5.26), you are should download version 2.6.1 heer http://vshopping.tk/index.php/download-vshopping
Or you can change the database add a column `params` with varchar(250) on table #__vshop_orderdetail or on the file administrator/components/com_vshop/models/order.php in line 45 you can delete od.params and it works ok!
Thanks so much!
Thanks.. nice components..
ReplyDeleteCái này chưa có phần cuối hả A Vũ Mai.
ReplyDeleteNhư: Đặt hàng, quản lý khách hàng...
E đang mong phần cuối. Hihi.
Cảm ơn A.
anh Vũ Mai ơi cho em hỏi clip 1 anh dùng phần mềm gì thế có thể cho em link download hoặc tên của phần mềm cũng được. Em mới bắt đầu tìm hiểu nên chưa biết gì nhiều mong anh hướng dẫn Thank!
ReplyDelete