Shopperpress error

Ang shopperpress, hvordan i huleste fikser jeg dette? Jeg har ikke peiling på php...

Parse error: syntax error, unexpected '{' in /home/content/25/3827825/html/bokkiosken/wp-content/themes/shopperpress/functions.php on line 167
 

stianweb

Medlem
virker som om det er en spørring som ikke er avsluttet etter linje 167 i functions.php, men uten å ha sett koden, så er det litt vanskelig å si.
 
Åja, beklager, King. Det er et eneste jeg har, jeg har akkurat installert det. Tok preview på themet, og feilmeldingen kom. Er en Amazon-greie her, slik at dette themet skal være lett å sette opp slik at man kan legge ut Amazon-varer og få aff-inntekter. Linjen med feil er inni Amazon-delen, men jeg er helt blank på php.

Hjelper det om jeg legger inn hele filen det gjelder? Stor fil..
 
Sist redigert:
<?php
/*

SHOPPERPRESS DEVELOPED BY MARK FAIL
Premium Wordpress Themes - PremiumPress
Wordpress Shopping Cart - ShopperPress

Follow on twitter: Mark Fail (markfail) on Twitter
Follow on twitter: http://www.twitter.com/shopperpress

*/

//ini_set( 'display_errors', 1 );
//error_reporting( E_WARNING );
//$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'];


/* ============================= PREMIUM PRESS SESSIONS ========================= */

if(!session_id())session_start();
if(isset($_GET['emptyCart'])){ foreach($_SESSION as $key => $value){ unset($_SESSION[$key]); }}
if(!isset($_SESSION['ddc']['cartqty'])) $_SESSION['ddc']['cartqty'] = 0;
if(!isset($_SESSION['ddc']['price'])) $_SESSION['ddc']['price'] = 0.00;

/* ============================= PREMIUM PRESS CONSTANTS ========================= */

define("PREMIUMPRESS_SYSTEM","ShopperPress");
define("PREMIUMPRESS_VERSION","5.0f");
define("PREMIUMPRESS_VERSION_DATE","12th Nov, 2010");

/* ============================= PREMIUM PRESS INCLUDES ========================= */

$functions_path = TEMPLATEPATH . '/functions/';
define("THEME_PATH","".$functions_path."");

if(defined('TEMPLATEPATH')){

if(!defined('PREMIUMPRESS_PLUGIN')){
include($functions_path ."premiumpress/premiumpress.php");
include($functions_path ."premiumpress/premiumpress_funcs.php");
include($functions_path ."premiumpress/premiumpress_class.php");
include($functions_path ."premiumpress/premiumpress_class1.php");
}

include($functions_path ."premiumpress/premiumpress_customfields.php");
include($functions_path ."admin-options.php");
include($functions_path ."custom-options.php");
include($functions_path ."func_general.php");
include($functions_path ."func_download.php");
include($functions_path ."func_cart.php");
include($functions_path ."func_image.php");
require($functions_path ."func_callback.php");
require($functions_path ."func_display.php");

$PPT = new PremiumPressTheme();

}

/* ============================= PREMIUM PRESS REGISTER WIDGETS ========================= */

if ( function_exists('register_sidebar') ){

register_sidebar(array('name'=>'Left Sidebar',
'before_widget' => '<div style="clear:both;"></div><div class="menubox_box">',
'after_widget' => '</div>',
'before_title' => '<h2><span>',
'after_title' => '</span></h2>',
));

register_sidebar(array('name'=>'Right Sidebar',
'before_widget' => '<div style="clear:both;"></div><div class="menubox_box">',
'after_widget' => '</div>',
'before_title' => '<h2><span>',
'after_title' => '</span></h2>',
));

register_sidebar(array('name'=>'Right Sidebar (Product Page)',
'before_widget' => '<div style="clear:both;"></div><div class="menubox_box">',
'after_widget' => '</div>',
'before_title' => '<h2><span>',
'after_title' => '</span></h2>',
));

register_sidebar(array('name'=>'Right Sidebar (Article Page)',
'before_widget' => '<div style="clear:both;"></div><div class="menubox_box">',
'after_widget' => '</div>',
'before_title' => '<h2><span>',
'after_title' => '</span></h2>',
));

register_sidebar(array('name'=>'Footer',
'before_widget' => '<div class="Footer_Widget">',
'after_widget' => '</div>',
'before_title' => '<div style="" class="bar3"><h2>',
'after_title' => '</h2></div>',
));

register_sidebar(array('name'=>'Home Page (Left Column)',
'before_widget' => '<div style="clear:both;"></div><div class="menubox_box">',
'after_widget' => '</div>',
'before_title' => '<h2><span>',
'after_title' => '</span></h2>',
));
}

/* =================== PREMIUM PRESS AMAZON DELETE SEARCH ====================== */

if(isset($_GET['delf']) && !isset($_POST['feed'])){

$PPT->AmazonDeleteSearch($_GET['delf']);
$GLOBALS['error'] = 1;
$GLOBALS['error_type'] = "ok"; //ok,warn,error,info
$GLOBALS['error_msg'] = "Schedule Deleted Successfully";

}elseif(isset($_POST['feed'])){

if($_POST['schedule']['name'] != ""){

if(isset($_POST['cat'][0])){
$PPT->AmazonSavedSearch();
$GLOBALS['error'] = 1;
$GLOBALS['error_type'] = "ok"; //ok,warn,error,info
$GLOBALS['error_msg'] = "Schedule Search Saved Successfully";
}else{
$GLOBALS['error'] = 1;
$GLOBALS['error_type'] = "error"; //ok,warn,error,info
$GLOBALS['error_msg'] = "No category selected, scheduled search NOT saved";
}

}else{

include_once("functions/amazon/amazon_api_class.php");
$GLOBALS['amazonsearch'] =1;

}
}

/* ========================= SHOPPERPRESS AMAZON SCHEDUALE ========================= */
//amazon_hourly();
function amazon_hourly() { global $wpdb; if(get_option('enabled_amazon_updater') == "yes"){ AmazonAutoUpdater(); } amazon_dreepfeed($ActionTime="hourly"); }
function amazon_daily() { amazon_dreepfeed($ActionTime="daily"); }
function amazon_twicedaily() { amazon_dreepfeed($ActionTime="twicedaily"); }
function amazon_dreepfeed($ActionTime="hourly") {

global $wpdb;

$PTH = TEMPLATEPATH . '/functions/';
$ASS = get_option("AmazonSavedSearch_Data");
$ACC = 0;

include_once($PTH ."amazon/amazon_api_class.php");
$obj = new AmazonProductAPI();

foreach($ASS as $SearchArray){

if($SearchArray['time'] == $ActionTime){

if($SearchArray['keyword'] != ""){

$importcounter = 0;
$_POST['amazon'] = $SearchArray;
$_POST['amazon']['keyword'] = $SearchArray['keyword'];
$_POST['amazon']['keyword_cat'] = $SearchArray['keyword_cat'];
$_POST['amazon']['cat'] = $SearchArray['cat'];

try
{
$result = $obj->searchProducts($_POST['amazon']['keyword'],$_POST['amazon']['keyword_cat'],$_POST['amazon']);
$SEARCHSTATUS = "Running";

//print_r($result->Items->TotalResults);

}
catch(Exception $e)
{
$SEARCHSTATUS = "Finished (".$e->getMessage().")";
}

$importcounter = AmazonSearchSave($result);

}else{

$SEARCHSTATUS = "Finished (No Keyword Entered)";

}
}

foreach($SearchArray as $key => $val){
if($key == "last" && ( $SearchArray['time'] == $ActionTime ) ) {
$val = date('l jS \of F Y h:i:s A');
}elseif($key == "total" && ( $SearchArray['time'] == $ActionTime ) ){
$val += $importcounter;
}elseif($key == "status" && ( $SearchArray['time'] == $ActionTime ) ){
$val = $SEARCHSTATUS;
}elseif($key == "start_page" && ( $SearchArray['time'] == $ActionTime ) ){
if(!is_numeric($val)){ $val = 1; }else{ $val++; }
}

$ASS_NEW[$ACC][$key] = $val;
}
$ACC++;
}

update_option("AmazonSavedSearch_Data",$ASS_NEW);
 
}

function AmazonAutoUpdater(){

global $wpdb;

$LASTID = get_option("amazon_updater_lastId");

if($LASTID ==""){ $LASTID=0; }
$country = get_option('enabled_amazon_updater_country');
$EXTRA = " AND $wpdb->posts.ID > ".$LASTID;

$SQL = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value AS GUID FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ($wpdb->postmeta.post_id = $wpdb->posts.ID)
WHERE $wpdb->postmeta.meta_key = 'amazon_guid' AND $wpdb->posts.post_status='publish'
".$EXTRA."
GROUP BY $wpdb->posts.ID
ORDER BY $wpdb->posts.ID ASC
LIMIT 20";

$results = (array)$wpdb->get_results($SQL);

if(is_array($results) && !empty($results)){

include_once("functions/amazon/amazon_api_class.php");

foreach($results as $value){

$obj = new AmazonProductAPI();
$item = $obj->getItemByAsin($value->GUID,$country);
$val = $item->Items->Item;



if($country =="co.uk" || $country =="jp"){

if( isset($val->Offers->Offer->OfferListing->Price->FormattedPrice) ){
$data['price'] = substr($val->Offers->Offer->OfferListing->Price->FormattedPrice,2,10);
$data['old_price'] = substr($val->ItemAttributes->ListPrice->FormattedPrice,2,10);
}else{
$data['price'] = substr($val->ItemAttributes->ListPrice->FormattedPrice,2,10);
}


if(isset($val->OfferSummary->LowestNewPrice->FormattedPrice) && strlen($val->OfferSummary->LowestNewPrice->FormattedPrice) > 2){

$data['old_price'] = $data['price'];
$data['price'] = substr($val->OfferSummary->LowestNewPrice->FormattedPrice,2,10);

}


}elseif($country =="de" || $country =="fr"){

$data['price'] = str_replace(",",".",substr($val->Offers->Offer->OfferListing->Price->FormattedPrice,4,10));

}elseif($country =="ca"){

$data['price'] = substr($val->Offers->Offer->OfferListing->Price->FormattedPrice,5,10);

}else{

if( isset($val->Offers->Offer->OfferListing->Price->FormattedPrice) ){
$data['price'] = substr($val->Offers->Offer->OfferListing->Price->FormattedPrice,1,10);
$data['old_price'] = substr($val->ItemAttributes->ListPrice->FormattedPrice,1,10);
}else{
$data['price'] = substr($val->ItemAttributes->ListPrice->FormattedPrice,1,10);
}


if(isset($val->OfferSummary->LowestNewPrice->FormattedPrice) && strlen($val->OfferSummary->LowestNewPrice->FormattedPrice) > 2){

$data['old_price'] = $data['price'];
$data['price'] = substr($val->OfferSummary->LowestNewPrice->FormattedPrice,1,10);

}



}















if($data['price'] > 0){
update_post_meta($value->ID, 'price', $data['price']);
}
if($data['old_price'] > 0){
update_post_meta($value->ID, 'old_price', $data['old_price']);
}

}

update_option("amazon_updater_lastId", $value->ID);

}else{
update_option("amazon_updater_lastId", 0);
}

}

/* ============================= PREMIUM PRESS HEADER STYLES ========================= */


function admin_head() {

$pages_array = array('premiumpress.php','setup','checkout','shipping','display','submit','payments','orders','advertising','tools','analytics','images','emails','updates','import');
if(in_array($_GET['page'],$pages_array) || isset($_GET['post']) ){

echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/functions/admin-style.css" media="screen" />';
echo '<script type="text/javascript" src="'.get_bloginfo('template_directory').'/functions/ajax/shopperpress_ajax.js"></script>';
echo '<script type="text/javascript" src="'.get_bloginfo('template_directory').'/functions/ajax/premiumpress.js"></script>';

PremiumPress_Meta();

}
}


if(!function_exists("updateQty")){ function updateQty() {
$qty = 0;

if(is_array($_SESSION['ddc']['productsincart'])){
foreach($_SESSION['ddc']['productsincart'] as $qtyval) {
$qty = $qty + $qtyval;
}
}
$_SESSION['ddc']['cartqty'] = $qty;
return $qty;
} }


if(!function_exists("updatePrice")){ function updatePrice() {

global $wpdb; $total = 0; $extraPrice =0;

if(isset($_SESSION['ddc']['productsincart']) && is_array($_SESSION['ddc']['productsincart']) ) {
foreach($_SESSION['ddc']['productsincart'] as $product => $qty) {

if($GLOBALS['shopperpress']['system'] =="credit"){
if($_SESSION['ddc']['cartqty'] > 0){
return $_SESSION['ddc'][$product]['custom1'];//"55";//get_option('credit_price_'.$_SESSION['ddc'][$product]['custom1']);
}
}else{

if(isset($_SESSION['ddc'][$product]['main_ID'])){
$product = $_SESSION['ddc'][$product]['main_ID'];
}

if(isset($_SESSION['ddc'][$product]['custom3'])){
$extraPrice += $_SESSION['ddc'][$product]['custom3'];
}

if(isset($_SESSION['ddc'][$product]['custom6'])){
$extraPrice += $_SESSION['ddc'][$product]['custom6'];
}

$total = $total + $extraPrice + getProductPrice($product,$product)*$qty;
}
}
}

return $total;

} }


if(!function_exists("getProductPrice")){ function getProductPrice($id, $copyID="") {

global $wpdb;

if(is_numeric($copyID) && $copyID != 0){ $id = $copyID; }

if(function_exists('get_post_meta')){

$PriceIncludingExtra = GetPrice(get_post_meta($id, "price", true));

return $PriceIncludingExtra;
}
}
}
 
function javascript_footer(){ ?>

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/_ShopperPress.js"></script> <!-- shopperpress custom -->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/functions/ajax/shopperpress_ajax.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/superfish.js"></script> <!-- menu styles -->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/ddcart.php?sid=<?php echo session_id(); ?>"></script>
<script type="text/javascript"> $(function(){$('ul.sf-menu').superfish();});</script>

<?php if($GLOBALS['shopperpress']['subnav'] =="yes"){ ?>

<script type="text/javascript">

$(document).ready(function() {
$(".dropdown img.flag").addClass("flagvisibility");

$(".dropdown dt a").click(function() {
$(".dropdown dd ul").toggle();
});

$(".dropdown dd ul li a").click(function() {
var text = $(this).html();
$(".dropdown dt a span").html(text);
$(".dropdown dd ul").hide();
// $("#result").html("Selected value is: " + getSelectedValue("sample"));
});


$(".dropdown1 img.flag").addClass("flagvisibility");

$(".dropdown1 dt a").click(function() {
$(".dropdown1 dd ul").toggle();
});

$(".dropdown1 dd ul li a").click(function() {
var text = $(this).html();
$(".dropdown1 dt a span").html(text);
$(".dropdown1 dd ul").hide();
// $("#result").html("Selected value is: " + getSelectedValue("sample"));
});

function getSelectedValue(id) {
return $("#" + id).find("dt a span.value").html();
}

$(document).bind('click', function(e) {
var $clicked = $(e.target);
if (! $clicked.parents().hasClass("dropdown"))
$(".dropdown dd ul").hide();
if (! $clicked.parents().hasClass("dropdown1"))
$(".dropdown1 dd ul").hide();
});


$("#flagSwitcher").click(function() {
$(".dropdown img.flag").toggleClass("flagvisibility");
});
});
</script>

<?php } ?>

<?php if(is_home() && get_option("display_featuredbox") =="1" ){ ?>
<script src="<?php bloginfo('template_url'); ?>/scripts/s3Slider.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
$('#featured-item').s3Slider({
timeOut: 6000
});
});
</script>
<?php } ?>

<?php if(is_single()){ ?>




<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
$(function() {
$('#gallery a').lightBox();
});
</script>
<?php } ?>


<?php if(is_page()){ ?>

<script language="JavaScript">

function formCheck(formobj){
// Enter name of mandatory fields
var fieldRequired = Array("billing[fname]", "billing[lname]", "billing[address1]", "billing[phone]", "billing[city]", "billing[zip]");
// Enter field description to appear in the dialog box
var fieldDescription = Array("First Name", "Last Name","Address","Phone","City", "Zip/Post Code");
// dialog message
var alertMsg = "Please complete the following fields:\n";

var l_Msg = alertMsg.length;

for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription + "\n";
}
break;
default:
}
if (obj.type == undefined){
var blnchecked = false;
for (var j = 0; j < obj.length; j++){
if (obj[j].checked){
blnchecked = true;
}
}
if (!blnchecked){
alertMsg += " - " + fieldDescription + "\n";
}
}
}
}

if (alertMsg.length == l_Msg){
return true;
}else{
alert(alertMsg);
return false;
}
}
// -->
</script>
<?php } ?>

<script type="text/javascript">function handleError() {return true;}window.onerror = handleError;</script>
<?php }

/**
* Sets up the javascript AJAX environment.
*/
function javascript_ajax_header( ) {
// Define custom JavaScript function

$ShopperPressTheme = $GLOBALS['premiumpress']['theme'];
if(strlen($ShopperPressTheme) < 2){ $ShopperPressTheme="default"; }
?>

<?php echo stripslashes(get_option("google_webmaster_code")); ?>
<style type="text/css" media="screen">
@import url( <?php bloginfo('template_url'); ?>/style.css );
</style>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>

<link href="<?php bloginfo('template_url'); ?>/themes/<?php echo $ShopperPressTheme; ?>/css/styles.css" type="text/css" rel="stylesheet" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/themes/ie6.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/themes/ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/themes/ie8.css" />
<![endif]-->
<?php
}




if(defined('TEMPLATEPATH')){

// hook into WordPress
add_action('wp_head', 'javascript_ajax_header' );
add_action('admin_head', 'admin_head');
add_action('admin_menu', 'shopperpress_options');

// CHECK FOR DAILY SCHEDUALS
if (!wp_next_scheduled('amazon_search')) {
wp_schedule_event( time(), 'hourly', 'amazon_search' );
wp_schedule_event( time(), 'twicedaily', 'amazon_twicedaily' );
wp_schedule_event( time(), 'daily', 'amazon_daily' );
}

add_action( 'amazon_search', 'amazon_dreepfeed' );

// WORDPRESS RECOMMENDED REMOVALS
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');

// activate support for .mo localization files
load_theme_textdomain('cp');

// IMPORTANT, DO NOT REMOVE
add_filter('posts_where', array($PPT, 'query_where'));
add_filter('posts_join', array($PPT, 'query_join') );
add_filter('posts_orderby', array($PPT, 'query_orderby') );
add_filter('post_limits', array($PPT, 'query_limits') );

}


?>
 

Nutz

Med lem
Moneymaker.
Problemet dukker opp i området:
try
{
$result = ....

Har du en gammel versjon av PHP?
Vet at PHP 4.?? ikke har, eller har god støte for "try-catch"-blokker
 
Må vel sende dem en mail eller noe. Takk for svar.

En annen ting: Når jeg prøver å redigere stylesheet-en henger pcen seg. Er det bare hos meg dette skjer, eller er det andre her som har erfart det samme?
 
Topp