Post by Qphoria » Wed Jun 30, 2010 10:15 pm

Here's a quick option that adds a "Merge Saved Cart" checkbox option to the login page.
That will give customers a checkbox that says "Merge Saved Cart?"
When checked, it will merge
When unchecked, it will not merge

1. EDIT: catalog/controller/account/login.php

2. FIND:

Code: Select all

if (isset($this->request->post['email']) && isset($this->request->post['password']) && $this->validate()) {  
3. BEFORE, ADD:

Code: Select all

//Q: Merge Cart Checkbox
if (!isset($this->request->post['merge'])) {
    $this->session->data['merge'] = false;
}//   
4. EDIT: catalog/view/theme/default/template/account/login.tpl

5. FIND:

Code: Select all

<div style="text-align: right;"><a onclick="$('#login').submit();" class="button"><span><?php echo $button_login; ?></span></a></div>
6. BEFORE, ADD:

Code: Select all

<!--//Q: START Merge Cart Checkbox -->
            <br />
            <input type="checkbox" name="merge" id="merge" checked="checked" value="1" /><label for="merge">Merge Saved Cart?</label>
            <!--//Q: END Merge Cart Checkbox -->     
7. EDIT: system/library/customer.php

8. FIND:

Code: Select all

$cart = unserialize($customer_query->row['cart']);  
9. AFTER, ADD:

Code: Select all

//Q: Merge Cart Checkbox
if (isset($this->session->data['merge'])) {
    $cart = array();
    unset($this->session->data['merge']);
}//     

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by zacky12 » Mon Dec 09, 2019 3:20 am

Hi, didnt work for me on 2.0.3.1. Is there any update for OC2 ? Thank you :)

Newbie

Posts

Joined
Mon Dec 09, 2019 3:18 am
Who is online

Users browsing this forum: No registered users and 2 guests