LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2009, 09:27 AM   #1
Randall Slack
Member
 
Registered: Feb 2005
Location: Rotterdam, The Netherlands
Distribution: Debian - Ubuntu
Posts: 219

Rep: Reputation: 30
oscommerce 3.05 custom variants via $_GET


hi all,

i'm trying to make some use out of a new feature in oscommerce http://blogs.oscommerce.com/2007/08/...custom-values/

what i would like to do is to have the custom value that can be manually given to each product come from the URL via the $_GET function.

till so far i have the idea that
PHP Code:
<?php echo $_GET["customvalue"]; ?>
should be included in
PHP Code:
$string .= '  <tr>' .
                   
'    <td width="100">' $field['text'] . ':</td>' .
                   
'    <td>' osc_draw_input_field('variants[' $data['group_id'] . '][' $field['id'] . ']'null'id="variants_' $data['group_id'] . '_' $i '"') . '</td>' .
                   
'  </tr>';
      } 
in the part below.
but till so far i have spend a few days trying to figure out how to do this and i have reached a definite mental block here, so if anybody has any pinters i's be much obliged.

Thanks anyway for reading this,

Randall

PHP Code:
<?php
/*
  $Id: $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2007 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/

  
class osC_Variants_text_field extends osC_Variants_Abstract {
    const 
ALLOW_MULTIPLE_VALUES true;
    const 
HAS_CUSTOM_VALUE true;

    static public function 
parse($data) {
      
$string '<table border="0" cellspacing="0" cellpadding="2">';

      
$i 0;

      foreach ( 
$data['data'] as $field ) {
        
$i++;

        
$string .= '  <tr>' .
                   
'    <td width="100">' $field['text'] . ':</td>' .
                   
'    <td>' osc_draw_input_field('variants[' $data['group_id'] . '][' $field['id'] . ']'null'id="variants_' $data['group_id'] . '_' $i '"') . '</td>' .
                   
'  </tr>';
      }

      
$string .= '</table>';

      return 
$string;
    }

    static public function 
getGroupTitle($data) {
      return 
$data['value_title'];
    }

    static public function 
getValueTitle($data) {
      return 
$_POST['variants'][$data['group_id']][$data['value_id']];
    }

    static public function 
allowsMultipleValues() {
      return 
self::ALLOW_MULTIPLE_VALUES;
    }

    static public function 
hasCustomValue() {
      return 
self::HAS_CUSTOM_VALUE;
    }
  }
?>
 
Old 09-11-2009, 05:28 AM   #2
Randall Slack
Member
 
Registered: Feb 2005
Location: Rotterdam, The Netherlands
Distribution: Debian - Ubuntu
Posts: 219

Original Poster
Rep: Reputation: 30
solved....................


problem was actually for the most part that i have oscommerce included inside a wordpress page, this works nice but the REAL URL for oscommerce turns out to be different then what is shown in the browser, makes sense but i just did not think of it..

after that it was simply fooling around a bit and i found that simply replacing , null, with , $_GET["customvalue"], does the trick.

PHP Code:
' <td width="100">' $field['text'] . ' :</td>' .
' <td>' osc_draw_input_field('variants[' $data['group_id'] . '][' $field['id'] . ']'$_GET["customvalue"], 'id="variants_' $data['group_id'] . '_' $i '"') . '</td>' .
' </tr>'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Globals in PHP and Smarty ($_GET) vargadanis Programming 6 12-01-2006 07:21 PM
PHP $_GET is getting weird info ghight Programming 2 08-11-2004 12:32 PM
Variants of X Stephanie General 5 05-15-2002 08:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration