Jump to content
X2Community Forums

[BUG] - Wrong URL in link to contact list from campaigns


Recommended Posts

(8.0, open source edition)

 

The link to the Contact List that appears on both the "All Campaigns" page (/index.php/marketing) and inside of a Campaign itself (e.g. /index.php/marketing/2) is incorrect. In my case my Campaign #2 is supposed to use Contact List #2, and the URL should be:

 

https://dynamic.wirespring.net/index.php/contacts/list/id/2

 

however on both of the above pages the link generated is:

 

https://dynamic.wirespring.net/index.php/list/id/2

 

which gives a 404 error.

 

The links on the All Contacts List are fine.

Link to post
Share on other sites

Hi wirespring, I have written a fix for this and it will be in the next update. 
If you need it now you'll need to edit protected/components/formatters/FieldFormatter.php

In the function renderAttribute add the line

 

if($field->fieldName == "listId")return $this->renderListLink();

 

after 

 

        if (!isset($field))
            return null;
 
 
And add this function to the file

 
    /*
     * renders the fields for list links
     */
    protected function renderListLink (){
 
        $url = null;
        // Use the controller
        $x2list = X2list::model()->findByAttributes(array('nameId' => $this->owner->listId));
        if(!isset($x2list)) return;
        $modelName = "contacts";
        if(!empty($x2list->modelName)) $modelName = strtolower($x2list->modelName);
        if($modelName == "x2leads")$modelName = "x2Leads";
 
 
        if(!ResponseUtil::isCli() && Yii::app()->controller instanceof CController && !Yii::app()->controller instanceof ProfileController) {
            $url = Yii::app()->controller->createAbsoluteUrl($modelName."/list", array('id' => $this->owner->id));
        }
        if(empty($url)) { // Construct an absolute URL; no web request data available.
            $url = Yii::app()->absoluteBaseUrl.(YII_UNIT_TESTING?'/index-test.php':'/index.php').$modelName."/list".'/'.$this->owner->id;
        }
 
 
        return CHtml::link(
            ''.X2Html::encode($x2list->name).'',
            $url,
            array()
        );
 
    }
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...