Fishpig Magento Integration

536 views Asked by At

Because I am not a professional programmer, I can’t get the ACF integration up for the fishpig magento running. Bought both the FishPig-ACF Add-on and the ACF Pro. Installed both and made a custom field named “repeater” and as the autor describes in his manual, I added this code to the /post/view.phtml:

<?php $value = $post->getMetaValue('repeater') ?>

So my view.phtml looks like this:

<?php
/**
 * @category    Fishpig
 * @package     Fishpig_Wordpress
 * @license     http://fishpig.co.uk/license.txt
 * @author      Ben Tideswell <[email protected]>
 */
?>
<?php $post = $this->getPost() ?>
<?php if ($post): ?>
<?php $helper = $this->helper('wordpress') ?>
<?php $author = $post->getAuthor() ?>
<div class="page-title post-title">
    <h1><?php echo $this->escapeHtml($post->getPostTitle()) ?></h1>
</div>
<div class="post-view">
    <p class="post-date when"><?php echo stripslashes($this->__('This entry was posted on %s<span class=\"by-author\"> by %s</span>.', $post->getPostDate(), $post->getAuthor()->getDisplayName())) ?></p>
    <?php echo $this->getBeforePostContentHtml() ?>
    <?php $value = $post->getMetaValue('repeater') ?>
    <div class="post-entry entry std<?php if ($post->getFeaturedImage()): ?> post-entry-with-image<?php endif; ?>">
        <?php if ($post->isViewableForVisitor()): ?>
            <?php if ($featuredImage = $post->getFeaturedImage()): ?>
                <div class="featured-image left"><img src="<?php echo $featuredImage->getAvailableImage() ?>" alt="<?php echo $this->escapeHtml($post->getPostTitle()) ?>"/></div>
            <?php endif; ?>
            <?php echo $post->getPostContent() ?>
        <?php else: ?>
            <?php echo $this->getPasswordProtectHtml() ?>
        <?php endif; ?>
    </div>
    <?php echo $this->getAfterPostContentHtml() ?>
    <?php echo $this->getCommentsHtml() ?>
    </div>
 <?php endif; ?> 

But in fronted the ACF is not shown.

THX for any help

1

There are 1 answers

2
Ben Tideswell On

You have copied and pasted the following code:

<?php $value = $post->getMetaValue('repeater') ?>

This code generates the repeater value and saves it in a variable named $value. That's it. This code doesn't do anything with this value or print it to the screen so the fact that nothing is displayed is correct.

To view what's inside the field, try the following:

<pre><?php print_r($post->getMetaValue('repeater')) ?></pre>

The above code will print out the value of the repeater field to the screen. Assuming you have set a value for this field for the current post, this value be an array containing the data that you set. You will then need to make use of foreach loops to cycle through the array and process/display the data.