Forum Replies Created

Viewing 15 replies - 1 through 15 (of 41 total)
  • Thread Starter kieranmcclung

    (@kieranmcclung)

    I’ve attached my code below in case anyone stumbles across this and wants an answer. It’s quite basic but should hopefully help you on your way.

    
    function wpf_shipping_cost_override( $rates, $package ) {
    
    	global $WOOCS;
    	// Array of shipping rate ids
    	$gbp_rates = array( 1, 2, 3, 4 );
    	
    	foreach ( $rates as $rate ) {
    		
    		// Get rate id
    		$id = end( explode( ':', $rate->id ) );
    		
    		// Check if in gbp rate array
    		if ( in_array( $id, $gbp_rates ) ) {
    			
    			$currencies = $WOOCS->get_currencies();
    			
    			// Get current gbp rate
    			$gbp_rate = $currencies['GBP']['rate'];
    			
    			// Get cost (currently converted)
    			$cost = $rate->cost;
    			
    			// Back convert cost based on $gbp_rate
    			$new_cost = $WOOCS->back_convert( $cost, $gbp_rate );
    			
    			// Set new cost
    			$rate->cost = $new_cost;
    			
    		}
    		
    	}
    	
    	return $rates;
    	
    }
    // Priority 10000 ensure this runs after conversion
    add_filter( 'woocommerce_package_rates', 'wpf_shipping_cost_override', 10000, 2 );
    
    Thread Starter kieranmcclung

    (@kieranmcclung)

    Thanks for getting back in touch and for including some links and information. It’s given me a good starting point.

    • This reply was modified 7 years, 11 months ago by kieranmcclung. Reason: Fixed wording
    Thread Starter kieranmcclung

    (@kieranmcclung)

    I have some more information. I’ve installed Query Monitor on the site and noticed that the HTTP request to Eventbrite is returning a 404 error with the details below. However if I enter in the OAuth token in the right hand side field it works correctly. Would there be a reason as to why the http request isn’t including the OAuth token?

    Strangely, though, these errors are appearing on the sidebar calls which is displaying events correctly.

    REQUEST

    PARSED AUTHENTICATION

    OAuth token: No valid OAuth token
    RESPONSE

    HTTP 401 UNAUTHORIZED
    Vary: Accept
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Headers: Authorization, Content-Type
    Content-Type: text/html; charset=utf-8
    Allow: GET, POST, DELETE, HEAD, OPTIONS
    {
    “status_code”: 401,
    “error_description”: “An OAuth token is required for all requests”,
    “error”: “NO_AUTH”
    }

    Thread Starter kieranmcclung

    (@kieranmcclung)

    Gah, sorry I didn’t realise you had replied! Unfortunately not, initially it didn’t have that in place so I added it to see whether it would fix the issue.

    Thread Starter kieranmcclung

    (@kieranmcclung)

    Perfect, all fixed. Many thanks for your help.

    I’m pretty sure that’s not related. It looks to be related to how new lines are handled in your WordPress as there are a couple of empty <p></p> tags which usually indicate hard returns.

    I’d guess that WordPress is opening a paragraph tag where you have added your gallery code. Best to just go into your WordPress content and choose the Text view to see if there are any tags around the gallery code. If there aren’t any try wrapping a pair of <div></div> around the gallery code to see if that fixes anything.

    **Edit**
    Thanks Johanna, I’m glad I could help.

    I can’t say that this is a perfect fix but hopefully it helps with the figuring out of why it is actually happening.

    <?php
    /**
    Template Page for the gallery overview
    
    Follow variables are useable :
    
    	$gallery     : Contain all about the gallery
    	$images      : Contain all images, path, title
    	$pagination  : Contain the pagination content
    
     You can check the content when you insert the tag <?php var_dump($variable) ?>
     If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
    **/
    ?>
    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    
    <div class="ngg-galleryoverview" id="<?php echo $gallery->anchor ?>">
    
    <?php if ($gallery->show_slideshow) { ?>
    	<!-- Slideshow link -->
    	<div class="slideshowlink">
    		<a class="slideshowlink" href="<?php echo nextgen_esc_url($gallery->slideshow_link) ?>">
    			<?php echo $gallery->slideshow_link_text ?>
    		</a>
    	</div>
    <?php } ?>
    
    <?php if ($gallery->show_piclens) { ?>
    	<!-- Piclense link -->
    	<div class="piclenselink">
    		<a class="piclenselink" href="<?php echo nextgen_esc_url($gallery->piclens_link) ?>">
    			<?php _e('[View with PicLens]','nggallery'); ?>
    		</a>
    	</div>
    <?php } ?>
    
    	<!-- Thumbnails -->
        <?php $i = 0; ?>
    	<?php foreach ( $images as $image ) : ?>
    
    	<div id="ngg-image-<?php echo $gallery->ID .'-'. $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
    		<div class="ngg-gallery-thumbnail" >
    			<a href="<?php echo nextgen_esc_url($image->imageURL) ?>"
                   title="<?php echo esc_attr($image->description) ?>"
                   data-src="<?php echo nextgen_esc_url($image->imageURL); ?>"
                   data-thumbnail="<?php echo nextgen_esc_url($image->thumbnailURL); ?>"
                   data-image-id="<?php echo esc_attr($image->pid); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr($image->description); ?>"
                   class="ngg_lightbox" >
    				<?php if ( !$image->hidden ) { ?>
    				<img title="<?php echo esc_attr($image->alttext) ?>" alt="<?php echo esc_attr($image->alttext) ?>" src="<?php echo nextgen_esc_url($image->thumbnailURL) ?>" <?php echo $image->size ?> />
    				<?php } ?>
    			</a>
    		</div>
    	</div>
    
        <?php if ( $image->hidden ) continue; ?>
        <?php if ($gallery->columns > 0): ?>
            <?php if ((($i + 1) % $gallery->columns) == 0 ): ?>
                <br style="clear: both" />
            <?php endif; ?>
        <?php endif; ?>
        <?php $i++; ?>
    
     	<?php endforeach; ?>
    
    	<!-- Pagination -->
     	<?php echo $pagination ?>
    
    </div>
    
    <?php endif; ?>

    Try that and let me know how it goes ??

    Could you post your full gallery code please or put it on jsfiddle?

    Ahh! My apologies. Initially I thought you mean that your galleries had duplicate IDs (which mine did hence the fix) This is a different thing however you can fix it by doing the following:

    In the template where it says <?php echo $image->thumbcode ?> > (around line:50). I removed that line and replaced it with class="<?php echo 'shutterset_'.$gallery->ID.''; ?>" >. Now this works for me because I’m using the shutterset lightbox animation. If you’re using another type you will need to check what class is added to the anchor tag and swap that out.

    What that <?php echo $image->thumbcode ?> code was doing in my case was outputting all the data-src, data-thumb etc. again hence why you get the dupes.

    **Edit:**
    Just checked your test link and class="ngg_lightbox" should work for you. So replace line: 50 (<?php echo $image->thumbcode ?> >) with class="ngg_lightbox" >

    Hello Johanna,
    I saw your tweet and came rushing over, hopefully I can help.

    It seems you have created the gallery perfectly fine. What I did now was go to the Gallery Settings and select NextGen Basic Thumbnails. In here I could select the template and apply it to all galleries. You can even just visit this area to ensure that your template is there. It’s listed as Parent Theme: gallery-[template_name].php

    I’m using the add gallery button in the content editor to add the gallery, rather than a short code.

    Where things might differ is if you’re using a different gallery in which case I can only assume they use different templates. All you would need to do though would be to place the ngg-image-<?php echo $gallery->ID .'-'. $image->pid ?> as the ID.

    Let me know if you need any more help though.

    I know this is an old topic however I’ve just managed to correct this issue.

    You will need to create a template Click here (scroll down to the HOW TO CREATE YOUR OWN TEMPLATES section)

    Follow the instructions there and when you have the new template setup look for the opening ngg-image div. (around line: 41) place this as the id

    ngg-image-<?php echo $gallery->ID .'-'. $image->pid ?>

    This will give you the gallery ID then the image ID so you won’t have any duplicate IDs. Next step is to fix the pagination though…

    Hello there,

    I’ve also ran into this issue and have put in a temporary fix which has worked for me. It’s not an ideal fix by any means but will hopefully help you through until something official is released.

    If you go to:
    wp-content > plugins > stella-free > js
    and open up post-tabs.js

    Directly after line 7
    jQuery(document).ready(function($) {

    Place this line of code:
    if(!$('body').hasClass('toplevel_page_wpcf7')) {

    Then on line 69 place a closing brace, just before the function closes.

    This will now stop the function from running when on the contact form page but it will work elsewhere.

    Thread Starter kieranmcclung

    (@kieranmcclung)

    Thanks Vavooon

    Thread Starter kieranmcclung

    (@kieranmcclung)

    Sure can, is there a way to send it securely?

    Thread Starter kieranmcclung

    (@kieranmcclung)

    I’m running Chrome on Mac so can only use the Chrome developer tools. Nothing is being flagged in there though, just a warning about using dppx in the css. To my knowledge that will only show script and styling errors, is that what you needed?

Viewing 15 replies - 1 through 15 (of 41 total)