• I have this store that is not supported anymore. If I need to customize it I have to dig through all the code. I want to add one more field to the table. I figured if I experiment with the values that work I could edit that. I don’t see how Company/Organization’,’Mycart is getting the value to ‘Customer\’s Company’,’Mycart’

    function exportcolumns () {
    		$prefix = "c.";
    		return array(
    			$prefix.'firstname' => __('Customer\'s First Name','Mycart'),
    			$prefix.'lastname' => __('Customer\'s Last Name','Mycart'),
    			$prefix.'email' => __('Customer\'s Email Address','Mycart'),
    			$prefix.'phone' => __('Customer\'s Phone Number','Mycart'),
    			$prefix.'company' => __('Customer\'s Company','Mycart'),
    			$prefix.'marketing' => __('Customer\'s Marketing Preference','Mycart'),
    			$prefix.'created' => __('Customer Created Date','Mycart'),
    			$prefix.'modified' => __('Customer Last Updated Date','Mycart'),
    
    			);
    	}
    //below from checkout page
    mycart('checkout','company','size=22&title='.__('Company/Organization','Mycart')); ?><label for="company"><?php _e('Company Organization','Mycart'); ?></label>
Viewing 9 replies - 1 through 9 (of 9 total)
  • That function is only returning an array of labels. It has nothing to do with how any data is being stored or saved in a shopping cart.

    Thread Starter Bloke

    (@bloke)

    Thanks. With Dreamweaver I have searched every file for any reference to these values to see if I can find how its done. What do you recommend looking for? I found a DB class and looked through that. There are classes for order, checkout, purchase, customer. Plus many more. thee are alot of functions like above that seem to export. Not sure why because in the admin there is no export functionality. Seems they copy data from one table to move to another.

    Look at the html output from the form and look for <input name="xxxxxxxxx"

    The input name attribute is used to identify the data when it gets posted using php. You should be able to then find it by searching for $_POST['xxxxxxxxx']

    Thread Starter Bloke

    (@bloke)

    Yes I did that its posted above on the last line. For the value of “company” they have
    <span><?php mycart('checkout','company','size=22&title='.__('Company/Organization','Mycart')); ?><label for="company"><?php _e('Company Organization','Mycart'); ?></label></span>

    Then on this file there is a function with many switch statements.

    case "company":
    				if ($options['mode'] == "value") return $this->Customer->company;
    				if (!empty($this->Customer->company))
    					$options['value'] = $this->Customer->company;
    				return '<input type="text" name="company" id="company" '.inputattrs($options).' />';
    				break;

    Thread Starter Bloke

    (@bloke)

    I found this in the DB (database) class. Is it taking that array of information and inserting to the database?

    /**
    	 * Gets data from the session data table and loads Member
    	 * objects into the User from the loaded data.
    	 *
    	 * @return boolean
    	 **/
    	function load ($id) {
    		$db = &DB::get();
    
    		if (is_robot() || empty($this->session)) return true;
    
    		$loaded = false;
    
    		$query = "SELECT * FROM $this->_table WHERE session='$this->session'";
    		if ($result = $db->query($query)) {
    			if (substr($result->data,0,1) == "!") {
    				$key = $_COOKIE[MYCART_SECURE_KEY];
    				if (empty($key) && !is_mycart_secure())
    					mycart_redirect(force_ssl(raw_request_url(),true));
    				$readable = $db->query("SELECT AES_DECRYPT('".
    										mysql_real_escape_string(
    											base64_decode(
    												substr($result->data,1)
    											)
    										)."','$key') AS data");
    				$result->data = $readable->data;
    			}
    			$this->ip = $result->ip;
    			$this->data = unserialize($result->data);
    			$this->created = mktimestamp($result->created);
    			$this->modified = mktimestamp($result->modified);
    			$loaded = true;
    
    			do_action('mycart_session_loaded');
    		} else {
    			if (!empty($this->session))
    				$db->query("INSERT INTO $this->_table (session, ip, data, created, modified)
    							VALUES ('$this->session','$this->ip','',now(),now())");
    		}
    		do_action('mycart_session_load');
    
    		// Read standard session data
    		if (@file_exists("$this->path/sess_$id"))
    			return (string) @file_get_contents("$this->path/sess_$id");
    
    		return $loaded;
    	}

    Thread Starter Bloke

    (@bloke)

    I created a new column to see what it would do. Then check out would not process with the new column in the database table. So I need to find where or how it checks the names of the columns. I figured I found where it records the users IP address. So I copied that line changed it using a hard coded value like 1234 to see if that would work.

    Thread Starter Bloke

    (@bloke)

    Using a search there are no other references to the purchase or ip fields. I removed “none” from the table in the database because that was causing an issue.

    Now if I change this :
    $Purchase->ip = $Mycart->Shopping->ip;

    to this:

    $Purchase->ip = ‘12341’;

    It saves that value.

    If I try to add profid and add :
    $Purchase->profid = ‘1234’;
    it won’t save to the database.

    Moderator bcworkz

    (@bcworkz)

    You’ve taken on a very challenging project! Taking over someone else’s code with no support is mind numbing. I’m unsure what your specific problem is. Sorry I can’t help with that.

    I just wanted to suggest you try to use the provided hooks whenever possible (or even inserting some more hooks) instead of directly hacking the code. For example, the action ‘mycart_session_load’ gives you the opportunity to run your own code whenever this load method executes. You could use this hook to insert your data where ever and however you want, while leaving the original code untouched. Then you do not need to determine exactly what the code is doing, just do your own thing.

    Thread Starter Bloke

    (@bloke)

    Yes it is very confusing. also there is the WordPress side of things and then the PHP side. So when I post on PHP forums they don’t know WordPress. Also I can’t post every file on here. I am able to narrow down what I need to change. Such as when I edited the payment gateway. There is a folder for the gateways. I used Dreamweaver to search all the code for references to what I am looking for. Some parts are commented and some are not. I have put so much time into it I wouldn’t want to just buy another cart and start over. Because the cart is 99% of the website layout and functionality. Also all the products and images.

    I am try to solve issues one piece at a time. Currently am just trying to see how it saves data to the customers table. Because I want to record the transaction ID there.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Help saving values from form’ is closed to new replies.