Need help with joomla! custom developement.

Discussion in 'Joomla' started by sogastic, Jul 13, 2007.

  1. #1
    Hello.

    I have planned my website for few days and I was starting customizing joomla for my needs. At the moment I am changing Virtuemart add product page for fast and easy product managment. Unfortunately I can't figure out how does it insert data into database. I could find the file. It's called ps_product.php.
    I tried adding my own values to the part of the code which is INSERT INTO row names.. and values. Im pretty sure I inserted everything like the other ones there but it didn't work.

    If anyone has any experience with this, please help me out :)

    Thanks !
    Janar

    *

    I tought I'll make it bit easier and copy some of the code right to here so any other advanced in php whos not using joomla! could watch it over.

    Ok heres a code what i think is for $d and why my added $d for my own VALUE didn't work.
    I found 2 code pieces related to $d

    First:
    
    /**
    	 * Validates product fields and uploaded image files.
    	 *
    	 * @param array $d The input vars
    	 * @return boolean True when validation successful, false when not
    	 */
    	function validate(&$d) {
    		global $vmLogger, $database, $perm;
    		$valid = true;
    		$db = new ps_DB;
    		$ps_vendor_id = $_SESSION["ps_vendor_id"];
    		if( $perm->check( 'admin' )) {
    			$vendor_id = $d['vendor_id'];
    		}
    		else {
    			$vendor_id = $ps_vendor_id;
    		}
    
    
    Code (markup):

    
    function add( &$d ) {
    		global $perm, $vmLogger;
    		$database = new ps_DB();
    		
    		if (!$this->validate($d)) {
    			return false;
    		}
    
    		if (!process_images($d)) {
    			return false;
    		}
    
    		$timestamp = time();
    		$db = new ps_DB;
    
    Code (markup):

    And the value insert code. The first ones called "name" are added by me.
    
    $q  = "INSERT INTO #__{vm}_product (name,vendor_id,product_parent_id,product_sku,";
    		$q .= "product_name,product_desc,product_s_desc,";
    		$q .= "product_thumb_image,product_full_image,";
    		$q .= "product_publish,product_weight,product_weight_uom,";
    		$q .= "product_length,product_width,product_height,product_lwh_uom,";
    		$q .= "product_unit,product_packaging,"; // Changed Packaging - Added
    		$q .= "product_url,product_in_stock,";
    		$q .= "attribute,custom_attribute,";
    		$q .= "product_available_date,product_availability,product_special,product_discount_id,";
    		$q .= "cdate,mdate,product_tax_id) ";
    		$q .= "VALUES ('";
    		$q .= $d['name'] . "','" . $d['vendor_id'] . "','" . $d["product_parent_id"] . "','";
    		$q .= $d["product_sku"] . "','" . $d["product_name"] . "','";
    		$q .= $d["product_desc"] . "','" . $d["product_s_desc"] . "','";
    		$q .= $d["product_thumb_image"] . "','";
    		$q .= $d["product_full_image"] . "','" . $d["product_publish"] . "','";
    		$q .= $d["product_weight"] . "','" . $d["product_weight_uom"] . "','";
    		$q .= $d["product_length"] . "','" . $d["product_width"] . "','";
    		$q .= $d["product_height"] . "','" . $d["product_lwh_uom"] . "','";
    		$q .= $d["product_unit"] . "','" . (($d["product_box"] << 16) | ($d["product_packaging"]&0xFFFF)) . "','"; // Changed Packaging - Added
    		$q .= $d["product_url"] . "','" . $d["product_in_stock"] . "','";
    		$q .= $d["product_advanced_attribute"]."','";
    		$q .= $d["product_custom_attribute"]."','";
    		$q .= $d["product_available_date_timestamp"] . "','";
    		$q .= $d["product_availability"] . "','";
    		$q .= $d["product_special"] . "','";
    		$q .= $d["product_discount_id"] . "','$timestamp','$timestamp','".$d["product_tax_id"]."')";
    
    		$db->setQuery($q); $db->query();
    
    
    Code (markup):

     
    sogastic, Jul 13, 2007 IP
  2. sogastic

    sogastic Peon

    Messages:
    202
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ok I resolved the problems and got another one but I see that theres no joomla coders in this forum ?
     
    sogastic, Jul 15, 2007 IP
  3. Anghus

    Anghus Peon

    Messages:
    510
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    A good Idea would be to check the Virtuemart forum. A lot of good stuff there, and a friendly environment.
     
    Anghus, Jul 16, 2007 IP
  4. sogastic

    sogastic Peon

    Messages:
    202
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Virtuemart forum is so sleeeepy. Nobody ever answers
     
    sogastic, Jul 16, 2007 IP
  5. asutcu1

    asutcu1 Peon

    Messages:
    6
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes - I have been manytimjes to the Virtuemart forum and there is no traffic. Joomla forums have traffic and are quite helpful.
     
    asutcu1, Jul 17, 2007 IP