Đơn giản hóa các bước thanh toán của OpenCart – phần 2

19
3593

Chỉ mới test trên OpenCart: version 1.5.6.1

Như đã đề cập ở phần trước, chúng ta sẽ cùng chỉnh sửa modules AJAX Quick Checkout

Theo như mình kiểm tra thì module này không tạo ra bảng nào mới cả => họ sẽ lưu các thông số cấu hình trên file, cụ thể là mảng :D. Lần theo dấu vết em nó khoảng 2h đồng hồ thì mình đã tìm đến file config (system/config/quickcheckout_settings.php). Các bạn lưu ý đoạn code sau:

'option' => array(
									'register' => array(
										'display' => 1,
										'login' => array(),
										'payment_address' => array(
											'display' => 1,
											'title' => 'text_your_details',
											'description' => 'option_register_payment_address_description',
											'fields' => array(
												'firstname' => array('display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 1, 
																	 'require' => 1														
																	 ), 
												'email' => array(	 'display' => 1, 
																	 'require' => 1,
																	 'error' => array(0 => array('min_length' => 3, 
																						 'max_length' => 96, 
																						 'text' => array(1 => 'Sorry, but you need to have the length of the text more then 3 and less then 96 ')),
																			  1 => array('regex' => '/^[^\@]+@.*\.[a-z]{2,6}$/i', 
																						 'text' => 'error_email'),
																			  2 => array('email_exists' => true, 
																						 'text' => 'error_exists'),
																			  3 => array('not_empty' => true, 
																						 'text' => 'error_email')),
																	 ),
												'heading' => array(
																	 'display' => 1,														
																	 ),
												'telephone' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'fax' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'password' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'confirm' => array(
																     'display' => 1, 
																	 'require' => 1
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'company_id' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'customer_group_id' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'tax_id' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'newsletter' => array( 
																	 'display' => 1, 
																	 'require' => 0,
																	 'value' => '0'
																	 ),
												'shipping' => array( 
																	 'display' => 1,
																	 'value' => 1
																	 ),
												'agree' => array( 
																	 'display' => 1, 
																	 'require' => 0,
																	 'value' => '0'
																	 )
												
											)
										),
										'shipping_address' => array(
											'display' => 1,
											'require' => 0,
											'title' => 'option_register_shipping_address_title',
											'description' => 'option_register_shipping_address_description',
											'fields' => array(
												'firstname' => array( 
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array( 
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 )
												)
										),
										'shipping_method' => array(
												  'title' => 'option_register_shipping_method_title',
												  'description' => 'text_shipping_method',												  
												  ),
										'payment_method' =>array(
												  'title' => 'option_register_payment_method_title',
												  'description' => 'text_payment_method',
												  ),
										'cart' => array(
												  'display' => 1,
												  'title' => 'text_cart',
												  'description' => 'option_register_cart_description',
												  'option' => array(
														'voucher' => array(
																	'display' => 1
														),
														'coupon' => array(
																	'display' => 1
														),
														'reward' => array(
																	'display' => 1
														)
													),
												  'columns' => array(
														 'image' => 1,
														 'name' => 1,
														 'model' => 0,
														 'quantity' => 1,
														 'price' => 1,
														 'total' => 1
															)
										),										
										'confirm' => array(
												  'display' => 1,
												  'fields' => array(
												  		'comment' => array( 
															 'display' => 1, 
															 'require' => 0
														 ),
														'agree' => array( 
															 'display' => 1, 
															 'require' => 1
														 )
												  )	   
										)
									),
									'guest' => array(
										'display' => 1,
										'login' => array(),
										'payment_address' => array(
											'title' => 'text_your_details',
											'description' => 'option_guest_payment_address_description',
											'display' => 1,
											'fields' => array(
												'firstname' => array('display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 1, 
																	 'require' => 1														
																	 ), 
												'email' => array(	 'display' => 1, 
																	 'require' => 1,
																	 'error' => array(0 => array('min_length' => 3, 
																						 'max_length' => 96, 
																						 'text' => array(1 => 'Sorry, but you need to have the length of the text more then 3 and less then 96 ')),
																			  1 => array('regex' => '/^[^\@]+@.*\.[a-z]{2,6}$/i', 
																						 'text' => 'error_email'),
																			  2 => array('not_empty' => true, 
																						 'text' => 'error_email')),
																	 ),
												'heading' => array(
																	 'display' => 1														
																	 ),
												'telephone' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'fax' => array(
																	 'display' => 1, 
																	 'require' => 0	
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'company_id' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'customer_group_id' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'tax_id' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'shipping' => array( 
																	 'display' => 1,
																	 'value' => 1
																	 ),
												'agree' => array( 
																	 'display' => 1, 
																	 'require' => 0,
																	 'value' => '0'
																	 )
											)
										),
										'shipping_address' => array(
											'display' => 1,
											'require' => 0,
											'title' => 'option_guest_shipping_address_title',
											'description' => 'option_guest_shipping_address_description',
											'fields' => array(
												'firstname' => array( 
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array( 
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 )
												)
										),
										'shipping_method' =>array(
												  'title' => 'option_guest_shipping_method_title',
												  'description' => 'text_shipping_method',
												  
												  
										),
										'payment_method' =>array(
												  'title' => 'option_guest_payment_method_title',
												  'description' => 'text_payment_method',
										),
										'cart' => array(
												  'display' => 1,
												  'title' => 'text_cart',
												  'description' => 'option_guest_cart_description',
												  'option' => array(
														'voucher' => array(
																	'display' => 1
														),
														'coupon' => array(
																	'display' => 1
														),
														'reward' => array(
																	'display' => 1
														)
													),
												  'columns' => array(
														 'image' => 1,
														 'name' => 1,
														 'model' => 0,
														 'quantity' => 1,
														 'price' => 1,
														 'total' => 1
															)
										),										
										'confirm' => array(
												  'display' => 1,
												  'fields' => array(
												  		'comment' => array( 
															 'display' => 1, 
															 'require' => 0
														 ),
														'agree' => array( 
															 'display' => 1, 
															 'require' => 1
														 )
												  )	   
										)
									),
									'logged'=> array(
										'login' => array(),
										'payment_address' => array(
											'display' => 1,
											'title' => 'option_logged_payment_address_title',
											'description' => 'option_logged_payment_address_description',
											'fields' => array(
												'firstname' => array('display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 1, 
																	 'require' => 1															
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'company_id' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'tax_id' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'shipping' => array( 
																	 'display' => 1,
																	 'value' => 1
																	 ),
												'address_id' => array()
											)
										),
										'shipping_address' => array(
											'display' => 1,
											'require' => 0,
											'title' => 'option_logged_shipping_address_title',
											'description' => 'option_logged_shipping_address_description',
											'fields' => array(
												'firstname' => array( 
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'lastname' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'company' => array(
																	 'display' => 1, 
																	 'require' => 0
																	 ),
												'address_1' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'address_2' => array(
																	 'display' => 0, 
																	 'require' => 0
																	 ),
												'city' => array( 
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'postcode' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'country_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 ),
												'zone_id' => array(
																	 'display' => 1, 
																	 'require' => 1
																	 )
												)
										)

Mảng Options sẽ chứa có 3 thành phần là: register, guest,  logged. Trong 3 thành phần này còn có các phần nhỏ tương ứng với các phần trong checkout như: payment_address, shipping_address, shipping_method…bạn sẽ tùy chỉnh theo ý muốn ở các phần này. Mình ví dụ sẽ bỏ bớt lastname với khách hàng dạng guest (thành phần guest):

Mình tìm đến: ‘guest’ => array( và chỉnh sửa phần lastname:

'lastname' => array(
																	 'display' => 1, 
																	 'require' => 1

display: hiển thị.

require: có bắt buột hay không.

Lần lượt chỉnh 2 thông số này = 0 là xong. :D. Tương tự, bạn có thể thùy chỉnh các trường khác trong các thành phần khác nhau register, guest,  logged).

Notes: trong file có nhiều đoạn code khá giống nhau, các bạn nhớ tìm cho kỹ nhé ^^. Xin chào :D.

5/5 - (3 bình chọn)

19 BÌNH LUẬN

  1. bác ad cho em hỏi. mấy cái hihi ..
    1. Mình muốn bỏ phần thanh toán cho người đăng ký được không.
    2. bỏ Shipping method và Payment method như thế nào
    3. Sửa “Địa chỉ dòng 1:” thành “Địa chỉ:” như thế nào.

    Em tìm mãi mà không biết làm sao, 🙁 ..

    • Hi bạn, hiện tại mình cũng hơi bận nên trả lời bạn ngắn gọn như sau:

      1. Để bỏ các phần không mong muốn, bạn xem kỹ bài post và thử cho các thông số display, require của thuộc tính muốn tắt thành 0 nha.
      2. Phần sửa địa chỉ, bạn tìm đến các file Việt Hóa để sửa lại. File language: cataloglanguagevietnamesecheckoutcheckout.php, bạn tìm và sửa như ý muốn nhé.

      • Theo hướng dẫn của ad. mình đã xử lý xong phần 2 và phần 3.
        còn cái số 1: bỏ luôn phần thanh toán cho người đăng ký thì chưa.

        Cảm ơn bác ad nhiều :v hihi

  2. chào admin.
    Mình đang gặp tình trạng là mod chỉ chạy dc trên theme default , không chạy được với theme mình đang dùng .
    mình có tìm dc bản nulled của mod này trên mạng. không biết có có là do bản nulled hay ko

    Mong admin chỉ hướng mình fix lỗi này .

  3. Bạn thử qua phần quản lý của Vqmod xem coi có lỗi gì không nhé. Nếu nghi ngờ do bản null bạn có thể thử như hướng dẫn (mình dùng bản free). Nhưng mình không nghĩ do lỗi bản null, mà chắc theme bạn đang dùng xung đột gì đó 🙂

    Bạn thử xem sao nhé. Thân!

    • Hiện tại mình đang dùng theme free down từ trang chủ của opencart

      link theme: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=18662&filter_search=responsive&filter_license=0&filter_download_id=36&page=2

      Không biết bạn có thể xem giúp mình là chị xung đột chổ nào không. Mình đã xem log trong vqmod không có báo lỗi nào hết
      Mong bạn và mọi người giúp mình. Mình cảm ơn rất nhiều

  4. Khi bấm vào menu thanh toán thì bị lỗi thế này:
    Notice: Undefined index: customer_group_id in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1537Notice: Undefined index: firstname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1538Notice: Undefined index: lastname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1539Notice: Undefined index: email in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1540Notice: Undefined index: email in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1541Notice: Undefined index: telephone in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1544Notice: Undefined index: fax in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1545Notice: Undefined index: firstname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1552Notice: Undefined index: lastname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1553Notice: Undefined index: company in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1554Notice: Undefined index: company_id in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1555Notice: Undefined index: tax_id in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1556Notice: Undefined index: address_1 in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1557Notice: Undefined index: address_2 in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1558Notice: Undefined index: city in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1559Notice: Undefined index: postcode in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1560Notice: Undefined index: zone in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1561Notice: Undefined index: zone_id in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1562Notice: Undefined index: country in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1563Notice: Undefined index: country_id in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1564Notice: Undefined index: address_format in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1565Notice: Undefined index: firstname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1581Notice: Undefined index: lastname in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1582Notice: Undefined index: company in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1583Notice: Undefined index: address_1 in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1584Notice: Undefined index: address_2 in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1585Notice: Undefined index: city in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1586Notice: Undefined index: postcode in C:xampphtdocsopencartcatalogcontrollermodulequickcheckout.php on line 1587

  5. Mình có 2 vấn đề giống bác Hải Đăng
    1. Bỏ phần thanh toán cho người đăng ký
    2. bỏ Shipping method và Payment method
    Mình đã tìm rồi nhưng không thể làm được mong ad giúp đỡ. Cảm ơn ạ!

BÌNH LUẬN

Nội dung bình luận
Tên của bạn là gì?