function lhg_db_get_cheapest_price_by_region($postid, $search_region)
{
    global $region;
    #echo "RG: $region";
    #print "PID: $postid<br>";
    if ($search_region == "de" && $region != "de") {
        $postid = lhg_get_postid_de_from_com($postid);
    }
    if ($search_region != "de" && $region == "de") {
        $postid = lhg_get_postid_com_from_de($postid);
    }
    #print "PID2: $postid<br>";
    $shopids = lhg_return_shop_ids($search_region);
    #print "SIDS<br>";
    #var_dump($shopids);
    //which shop has this product?
    $products = lhg_get_sorted_products($shopids, $postid, $search_region);
    $price = $products[0]["price"] + $products[0]["shipping"];
    //return first one = cheapest
    return $price;
}
Beispiel #2
0
         echo "\n                        <td id=\"col-hw\"> <a class='hwscan-found-image' href='{$permalink}' target='_blank' >{$art_image}</a>\n\n                        " . '<div class="subscribe-hwtext"><div class="subscribe-hwtext-span-scan"><a href=' . $permalink . ' target="_blank">' . $short_title . '</a></div></div>' . $title_part2 . '</label>' . "<span class='subscribe-column-23'>{$rating}</span>";
         print " </td>";
     }
     //<td id=\"col4\">
     //<span class='subscribe-column-2'>$deact<br>({$a_subscription->status})</span>
     //</td>
     // --- Add to HW profile
     if ($userknown == 1) {
         $hwbutton = lhg_add_hwbutton($email, $a_identified_hw->postid);
         #$hwbutton = "Test";
         echo "\n                        \t<td id=\"col5\">\n\t                        <span class='column-hwbutton'>" . $hwbutton . "</span>\n                                <div class='regusers'>(Reg. Linux users: " . $usernum . ")</div>\n        \t                </td>";
     }
     // --- User to rate HW
     $postid = $a_identified_hw->postid;
     if ($lang == "de") {
         $postid = lhg_get_postid_de_from_com($postid);
     }
     #if ($myrating == "n.a.")
     echo "\n                        <td id=\"col4\">\n                        <span class='subscribe-column-2'>" . $out1 . "</span>\n                        </td>";
     #$registration_date=$a_subscription->dt;
     #list ($registration_date, $registration_time) = explode(" ",$registration_date);
     $categorypart2 = "";
     if ($category_name2 != "") {
         $categorypart2 = "<br>({$category_name2})";
     }
     echo "\n                        <td id=\"col2\">\n                        <span class='subscribe-column-1'><center>{$category_name} {$categorypart2} </center></span>\n                        </td>";
     echo "</tr>\n";
 }
 $usercomment_multi = lhg_get_usercomment_multi($sid, $id);
 $buttontype = "green";
 $buttontext = $txt_submit;
function lhg_country_row($p_region, $URLC, $URLD, $posturlcom, $posturlde)
{
    # store url to be available globally (e.g. by wp-one-post-widget)
    global $posturlcom_glob;
    global $posturlde_glob;
    $posturlcom = $posturlcom_glob;
    $posturlde = $posturlde_glob;
    global $post;
    global $txt_out_of_stock;
    global $region;
    $selected = "";
    if ($region == $p_region) {
        $selected = 'class="ct_pricetop" ';
    }
    #print "URLD: $URLD -- $posturlde<br>";
    print "<tr {$selected}>";
    #print "PID: $post->ID";
    # get the correct postid for .com and .de server
    $relevant_postid = $post->ID;
    if ($lang == "de") {
        $relevant_postid = lhg_get_postid_de_from_com($post->ID);
    }
    $price = lhg_db_get_cheapest_price_by_region($relevant_postid, $p_region);
    $price = lhg_float_to_currency_string($price, $p_region);
    if ($price == 0) {
        $price = $txt_out_of_stock;
        $txt_currency = "";
    } else {
        $txt_currency = lhg_get_currency_symbol($p_region);
        $price = $price;
    }
    #if ($p_region == "de"){
    #
    #        print "PRI: $price<br>";
    #        # ToDo: need access to .de database or Amazon prices to be stored on priceDB
    #        $price = "-";
    #        $txt_currency = "";
    #}
    echo '<td class="ct_country">&nbsp;&nbsp;';
    if ($p_region == "de") {
        $URL_add = '/';
        $flag = "de";
        $country = "Germany";
    }
    if ($p_region == "ca") {
        $URL_add = '/ca/';
        $flag = "ca";
        $country = "Canada";
    }
    if ($p_region == "com") {
        $URL_add = '/';
        $flag = "us";
        $country = "USA";
    }
    if ($p_region == "co.uk") {
        $URL_add = '/uk/';
        $flag = "uk";
        $country = "United Kingdom";
    }
    if ($p_region == "fr") {
        $URL_add = '/fr/';
        $flag = "fr";
        $country = "France";
    }
    if ($p_region == "es") {
        $URL_add = '/es/';
        $flag = "es";
        $country = "Espana";
    }
    if ($p_region == "it") {
        $URL_add = '/it/';
        $flag = "it";
        $country = "Italia";
    }
    if ($p_region == "nl") {
        $URL_add = '/nl/';
        $flag = "nl";
        $country = "Netherlands";
    }
    if ($p_region == "in") {
        $URL_add = '/in/';
        $flag = "in";
        $country = "India";
    }
    if ($p_region == "co.jp") {
        $URL_add = '/ja/';
        $flag = "jp";
        $country = "Japan";
    }
    if ($p_region == "cn") {
        $URL_add = '/zh/';
        $flag = "cn";
        $country = "China";
    }
    if ($p_region == "de") {
        $URL = $URLD . $URL_add . $posturlde;
    }
    if ($p_region != "de") {
        $URL = $URLC . $URL_add . $posturlcom;
    }
    echo '<a href="' . $URL . '"><img src="/wp-content/plugins/qtranslate/flags/' . $flag . '.png" alt="' . $country . '" /> ' . $country . '</a></td>';
    echo '<td class="ct_price">' . $price . '</td>';
    echo '<td class="ct_currency">' . $txt_currency . '</td>';
    echo '<td class="ct_comment">';
    # comment number
    #not yet implemented for "de"
    #if ($p_region == "de"){
    #        echo "-";
    #}else{
    lhg_comments_number_language($p_region, $p_region, 0, $post->ID, "shortversion");
    #}
    echo '</td></tr>';
}