Support » Fixing WordPress » Need Custom Different fields for each page between cart and checkout?

  • Iam using eShop Free wordpress plugin.. (eveyrthing is fine with this plugin..)

    BUT I need some customizations as per my requirement.. At first I need to add some extra fields

    Iam thinking to have one small form in which it contains details like keywords, url etc.. between cart and checkout somewhere, so that my visitor enter those details and so I can get his order details along with payment..

    So for that, they provided this:

    BUT I have another problem..

    Actually I need different fields for each page of same site..

    (say for Page1 Service, i need field1, field2)
    (say for Page2 Service, i need field3, field4)
    (say for Page3 Service, i need field5, field6)

    So to achieve above, what I have to do..?

    FYI, here is the code of eshop-extras.php

    // Make additional checkout field mandatory
    function eshop_extras_required($values) {
    $values[] = ‘eshop_extra’;
    return $values;

    // Add an additional field to the checkout within a new fieldset
    function eshop_extras_checkout($echo){
    $echo .= ‘<fieldset class=”eshop eshop_extra”>’ . “\n”;
    $echo .= ‘<legend>Extras</legend>’ . “\n”;
    $echo .= ‘<label for=”eshop_extra”>’.__(‘Extra Field’,’eshop’).’ <span class=”reqd”>*</span>
    <input class=”short” type=”text” name=”eshop_extra” value=”” id=”eshop_extra” maxlength=”20″ size=”20″ /></label>’;

    $echo .= ‘<label for=”keywords”>’.__(‘Keywords’,’eshop’).’ <span class=”reqd”>*</span>
    <input class=”short” type=”text” name=”keywords” value=”” id=”keywords” maxlength=”20″ size=”20″ /></label>’;

    $echo .= ‘</fieldset>’ . “\n”;
    return $echo;

    // Add extra field to error checks
    function eshop_extras_errorcheckout($_POST){
    if(!isset($_POST[‘eshop_extra’]) || trim($_POST[‘eshop_extra’])==”){
    $myerror= ‘

  • ‘.__(‘Extra Field – missing.’,’eshop_extras’).’
  • ‘;
    return $myerror;

    // Adds extra field to confirm details
    function eshop_extras_confcheckout($_POST){
    if( isset($_POST[‘eshop_extra’]) && $_POST[‘eshop_extra’] !=” ) {
    $echoit.='<h4>’.__(‘Extras’,’eshop’).'</h4><ul class=”eshop confirm”>’;
    $echoit.= “

    • <span class=\”items\”>”.__(‘Extra Field:’,’eshop’).”</span> “.$_POST[‘eshop_extra’].”

    return $echoit;

    // Saves extra field data in db
    function eshop_extras_orderhandle($_POST,$checkid){
    //we need to save the data
    global $wpdb;
    if(isset($_POST[‘eshop_extra’]) && $_POST[‘eshop_extra’]!=”){
    $table = $wpdb->prefix . “eshop_orders”;
    $query1=$wpdb->query(“UPDATE $table SET eshop_extra=’$eshop_extra’ where checkid=’$checkid’ limit 1”);

    // Adds extra field to details display
    function eshop_extras_showdetails($row){
    //add to order details page
    echo ‘<hr class=”eshopclear” />’;
    echo ‘<div><h4>Extra Field</h4>’;
    echo $row->eshop_extra.'</div>’;

    // Adds extra field to data extraction routines
    function eshop_extras_rtndetails($dquery){
    //extracting data from db for use whereever
    foreach($dquery as $drow){
    $array[‘eshop_extra’]=”Extra Field\n”.$eshop_extra.”\n”;
    return $array;

    // Adds extra field to emails
    function eshop_extras_emailtags(){
    // display any new codes

  • {EXTRA} – <?php _e(‘Extra Fields.’,’eshop’); ?>
  • <?php

    function eshop_extras_emailparse($filterit){
    $this_email = str_replace(‘{EXTRA}’, $array[‘eshop_extra’], $this_email);
    return $this_email;

    function eshop_extras_install(){
    //add to db on install
    global $wpdb;
    $table = $wpdb->prefix . “eshop_orders”;
    $tablefields = $wpdb->get_results(“DESCRIBE {$table}”);
    $add_field = TRUE;
    foreach ($tablefields as $tablefield) {
    if(strtolower($tablefield->Field)==’eshop_extra’) {
    $add_field = FALSE;
    if ($add_field) {
    $sql=”ALTER TABLE ".$table." ADD eshop_extra TEXT NOT NULL”;

    **Please suggest me how can i achive custom differnt fields between cart and checkout for each service page of same site?**

    Waiting for your responses!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Need Custom Different fields for each page between cart and checkout?’ is closed to new replies.