Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 15th, 2013, 05:13 PM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default Change button link destination?

Hi guys,
a bit of a long shot I know, but is there any way of changing the destination of the More Info button to a custom post type instead of the Store?

Or, instead of that, what would work for me is if I could imbed emded a link to where I want in each merchant's logo, and that link wasn't lost when the product list was displayed.
So I want to have a product list, and the only link in each product would be the logo, which would click through to my custom post type (which is a page dedicated to that merchant).
Hope that makes sense.

Thank you,
Philip.
  #2  
Old June 15th, 2013, 08:09 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi Philip,

The only way you can do that is to first map all merchant IDs to custom post type IDs. Then create a PHP function that handles the mapping. Then replace the links in the Factory with a call to the PHP function you created and pass in the merchant ID.

Eric
  #3  
Old June 16th, 2013, 03:40 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

OK Eric,

thanks. I sort of get the idea, but it's too complicated for me to do.

Does anyone on here offer customisation of this type?

Cheers,
Philip.
  #4  
Old June 16th, 2013, 08:34 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

This could help. Place the following into your theme's functions.php file:
PHP Code:
<?php
function map_mid_to_cpt$merchant_id ) {
    
$map = array(
        
12345 => get_permalink),
        
23456 => get_permalink),
        
34567 => get_permalink),
        
45678 => get_permalink),
        
56789 => get_permalink),
    );
    return 
$map[$merchant_id]; 
}
?>
12345, 23456, 34567, etc represent the Datafeedr merchant ID.
1, 2, 3, 4, 5 represent the ID of the post or page about that merchant. See http://codex.wordpress.org/Function_.../get_permalink for more info.

Then in your Views you would do something like this:
HTML Code:
<a href="<?php echo map_mid_to_cpt( $product->merchant_id ); ?>">More info</a>
Eric
  #5  
Old June 17th, 2013, 05:38 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Hi,
thanks very much for that Eric, much appreciated.

Unfortunately, I can't get it to point to the correct URL, though it is picking up the correct merchant OK.

Depending on where I put it, it either points to

Mysite.com/storehomepage?merchant_id=XXXX

or

mysite.com/merchantname/

neither of which is a valid URL.

So it looks like it's going to work, if I can figure out how to incorporate the ID properly for my site.

Thanks,
Philip.
  #6  
Old June 17th, 2013, 08:09 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Ooops,
had to remove that code from functions.php as I couldn't log in again while it was there.
Philip.
  #7  
Old June 17th, 2013, 08:37 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

What's the post ID and URL of a page about a single merchant?

Make sure you either include and/or exclude the opening and/or closing php tags (ie. <?php and ?>) properly when placing that code into your functions.php file to prevent the code from breaking your log in functionality.

Eric
  #8  
Old June 17th, 2013, 08:51 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Hi Eric,
I just copied the entire code into the functions file, after and seperate from everything else.

Here's an example merchant page

http://www.dohraymi.com/city/na/onli...ed-mp3-players
The post ID is 7903
The Datafeedr Merchant ID is 8303

Thank you,
Philip.
  #9  
Old June 17th, 2013, 08:57 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

So for those IDs, you'd have:

PHP Code:
function map_mid_to_cpt$merchant_id ) {
    
$map = array(
        
8303 => 7903,
    );
    return 
get_permalink$map[$merchant_id] ); 

I also modified the code just a bit.

Eric
  #10  
Old June 17th, 2013, 09:33 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Hi again,
thank you.
So I take a new line for each merchant and put the 2 numbers on it like this?

function map_mid_to_cpt( $merchant_id ) {
$map = array(
8303 => 7903,
DF ID => POST ID,
DF ID => POST ID,
DF ID => POST ID,
DF ID => POST ID,
ETC ETC
);
return get_permalink( $map[$merchant_id] );
}

and put that in Function.php and then put the other piece of code in my view?

Will it matter that I have nearly 300 merchants?

Thanks,
Philip.
  #11  
Old June 17th, 2013, 09:53 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

That's correct!

It won't matter for 300 merchants.

Eric
  #12  
Old June 17th, 2013, 10:49 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Hi,
I put the code into the functions.php file, with just 1 merchant to test it, but it messed up that part of the site, but now I can't get the functions.php file to save, it just goes to a blank page. I took the code out using FTP, and restored the file back to where it was just before I started, using a copy I had made, but I still can't save it.
My site is working OK.

Any idea what I did wrong?

I already have another Datafeedr function in there, although that didn't seem to matter earlier.

Being presumptious!, here's the entire code (it's a child theme)

<?php
################################# FIX IE 7 bugs #############################################
add_action( 'wp_head', 'ie_conditional' );
if (!function_exists('ie_conditional')) {
function ie_conditional()
{
echo "
<!--[if IE 7]>
<style>
#sidebar { margin-top:-16px;}
body.home #sidebar { margin-top:0px;}
#plusone-div {padding: 0 0 10px !important;}
#plusone-div {position:absolute;margin:12px 0 0 0 !important;display:inline;padding: 0 0 10px !important;}
</style>
<![endif]-->
<!--[if IE 8]>
<style>
#plusone-div {position:absolute;margin:12px 0 0 0 !important;display:inline;padding: 0 0 10px !important;}
</style>
<![endif]-->
";
}}
################################# END FIX FOR FACEBOOK LIKE THUMB URL ##########################################
function dfr_get_merchants() {
global $wpdb;
$merchants = $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products GROUP BY merchant");
$html = '<option value="">Select a merchant</option>';
foreach ($merchants as $k => $v) {
if (trim($v->merchant) != "") {
$selected = (strip_tags($_GET['merchant_id'])==$v->merchant_id) ? ' selected="selected"' : '';
$html .= '<option value="'.$v->merchant_id.'"'.$selected.'>'.$v->merchant.'</option>';
}
}
return $html;
}
?>


Thank you so much if you can help, again.
Philip.
  #13  
Old June 17th, 2013, 10:52 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Try saving via your WP Admin editor: WordPress Admin Area > Appearance > Editor > functions.php

Eric
  #14  
Old June 17th, 2013, 11:58 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Sorry, that's where I was trying, the "Update File" button.
Just goes to a blank page called http://www.dohraymi.com/wp-admin/theme-editor.php
Philip.
  #15  
Old June 17th, 2013, 12:14 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Sounds like you have some file permission issues. You might need to get your web host to help you sort out those issues.

Eric
  #16  
Old June 17th, 2013, 12:52 PM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

OK,
it's something to do with the functions file, I removed it and everythng is back to normal, apart from that file is missing of course haha.
I'll see what I can come up with.
Philip.
  #17  
Old June 18th, 2013, 08:21 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

OK,
going great guns now, it works well!

Just 2 more related question please

Can I put the code you gave me within some button code, so the link appears inside a button, instead of just a text link? (if so, where please)

Can I reduce the height of the box around each product? I can see the CSS for the width, 33% in my case as it's 3 columns, but I can't see anythng for the height. There's a lot of white space.

Thanks again for your help.
Philip.

Last edited by DohRayMi : June 18th, 2013 at 08:23 AM.
  #18  
Old June 18th, 2013, 08:53 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Yes, you simply need to do this:
HTML Code:
<a href="<?php echo map_mid_to_cpt( $product->merchant_id ); ?>" class="dfbutton dforange dflarge dfrounded">More info</a>
What page are you referring to regarding the height?

Eric
  #19  
Old June 18th, 2013, 09:04 AM
DohRayMi DohRayMi is offline
 
Join Date: Feb 2013
Posts: 167
Default

Thanks Eric,
it's on a test page at the minute - http://www.dohraymi dot com/city/portadown/local-vouchers/advertising-trailers
Regards,
Philip.
  #20  
Old June 18th, 2013, 09:08 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

You need to add this to your Custom CSS:

#view .pl .col3 .thmb { height: 30px; }

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Buy Button link problem - Seapets.co.uk moster1 Problems 4 August 10th, 2011 01:15 PM
Change Button text bucs0658 Questions 2 May 19th, 2011 11:18 AM
Details Button Link to Merchants cloudlife Questions 4 February 4th, 2011 05:19 PM


All times are GMT -5. The time now is 12:50 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.