Loading


Advertisement:

Author Topic: [Plugin] Print Ad  (Read 24486 times)

ronnnie

  • Jr. Member
  • **
  • Posts: 89
Re: [Plugin] Print Ad
« Reply #90 on: June 03, 2014, 05:16:31 am »
Thanks Chewyluke! I already use the cartagena's plugin PrintPDF, great plugin, but I think this is for the author of the ad, that can print and promote your ads with coupons, for example. I'm looking for a plugin that can print ads easy way for visitors, perhaps put google map on page printing, I need besides its print the "meta element" as url, telephone, fax, etc., its only really shows the phone number or url if the user complete this information on the registration form.

reflexus

  • Newbie
  • *
  • Posts: 9
Re: [Plugin] Print Ad
« Reply #91 on: March 26, 2016, 12:19:20 am »
Hi guys,

I had problem, when in description text were apostrophe or some special chars, part of description showed in item page and not in print page. There is easy solution, replace in index.php at start of file:
Code: [Select]
$desc = osc_item_description();
with
Code: [Select]
$desc = htmlspecialchars(osc_item_description());
That all, hope it helps ;)

Thanks!!!

miba

  • Newbie
  • *
  • Posts: 24
Re: [Plugin] Print Ad
« Reply #92 on: May 01, 2016, 05:27:47 pm »
Hi Jesse,
print ad is a very good plugin compliment.

I want to ask you, it is possible to integrate, the show is also the attributes
eg. custom_attributes or cars_attributes

miba

  • Newbie
  • *
  • Posts: 24
Re: [Plugin] Print Ad
« Reply #93 on: May 06, 2016, 11:20:59 pm »
Does anyone have an idea how to integrate custom_attributes?

Francesko

  • Newbie
  • *
  • Posts: 9
Re: [Plugin] Print Ad
« Reply #94 on: September 11, 2017, 06:40:38 pm »
+1 for custom fields. I'm playing with osc_item_meta_name() and osc_item_meta_value() functions but i can't get it to work!

Here is my "version" but doesn't work (dont know if the code is totally wrong  :P ). Im not very good at php!
In index.php i have added:
After $address = osc_user_address();:
Code: [Select]
    if( osc_count_item_meta() > 0 ) {
for ( $mindex = 0; osc_has_item_meta() ; $mindex++ ) {
    $meta_name[] = osc_item_meta_name();
    $meta_value[] = osc_item_meta_value();
}
    }
    if(count($meta_name)>0){
$meta_name = implode(",", $meta_name);
$meta_value = implode(",", $meta_value);
    }
After <form name="printform" action="'.$path.'print.php" method="post" target="printme" onsubmit="formpopup();">:
Code: [Select]
<input type="hidden" name="meta_name" value="'.htmlspecialchars($meta_name).'">
<input type="hidden" name="meta_value" value="'.htmlspecialchars($meta_value).'">

In print.php i have added:
After // Get posted data:
Code: [Select]
$meta_name = explode(",",$_POST['meta_name']);
$meta_value = explode(",",$_POST['meta_value']);
After   <?php _e('Description','printad'); ?>:</b> <?php echo $desc; ?>
Code: [Select]
    <?php if($meta_name[0]!=''){ ?>
    <?php for($sindex=0$sindex<count($meta_name); $sindex++){ ?>
<?php echo $meta_name[$sindex]; ?><?php echo $meta_value[$sindex]; ?>             
    <?php  ?>
    <?php ?>

It doesn't show anything

Francesko

  • Newbie
  • *
  • Posts: 9
Re: [Plugin] Print Ad
« Reply #95 on: September 13, 2017, 05:23:22 pm »
Finally i have got to work for Custom fields! Here is the solution:

In index.php :

Find:
Code: [Select]
View::newInstance()->_exportVariableToView('user', User::newInstance()->findByPrimaryKey(osc_item_user_id()));Add Code Below:
Code: [Select]
View::newInstance()->_erase('metafields');
Find:
Code: [Select]
// prepare arrays to be posted
    if(count($image_id)>0){
$image_id = implode(",", $image_id);
$image_path = implode(",", $image_path);
$image_ext = implode(",", $image_ext);
    }

Add Code Below:
Code: [Select]
    // Get & store all custom fields for the current item
    if( osc_count_item_meta() > 0 ) {
for ( $mindex = 0; osc_has_item_meta() ; $mindex++ ) {
    $meta_id[] = osc_item_meta_id();
    $meta_name[] = osc_item_meta_name();
    $meta_value[] = osc_item_meta_value();
}
    }

    // prepare arrays to be posted
    if(count($meta_id)>0){
$meta_id = implode(",", $meta_id);
$meta_name = implode(",", $meta_name);
$meta_value = implode(",", $meta_value);
    }

Find:

Code: [Select]
View::newInstance()->_reset('resources') ; //reset resources array (no helper function exisits for this as of now, but has been suggested)
Add Code Below:
Code: [Select]
View::newInstance()->_reset('metafields') ;
Find:
Code: [Select]
<form name="printform" id="printform" action="'.$path.'print.php" method="post" target="printme" onsubmit="formpopup();">Add Code Below:
Code: [Select]
<input type="hidden" name="meta_id" value="'.htmlspecialchars($meta_id).'">
<input type="hidden" name="meta_name" value="'.htmlspecialchars($meta_name).'">
<input type="hidden" name="meta_value" value="'.htmlspecialchars($meta_value).'">
============================
In print.php :

Find:
Code: [Select]
// Get posted dataAdd Code Below:
Code: [Select]
$meta_id = explode(",",$_POST['meta_id']);
$meta_name = explode(",",$_POST['meta_name']);
$meta_value = explode(",",$_POST['meta_value']);

Find:
Code: [Select]
    <div id="desc">
        <?php
          $dd 
explode("Tweet$"$desc2);
          
$first $arr[0];
        
?>

<b><?php _e('Description''printad'); ?>:</b> <?php echo $dd[0]; ?>
    </div>
Add Code Below:
Code: [Select]
<b><?php _e('Additional Informations''printad'); ?>:</b><br>
<?php if($meta_id[0]!=''){ ?>
<?php for($dindex=0$dindex<count($meta_id); $dindex++){ ?>
<?php if($meta_value[$dindex]!=''){ ?>
<li><?php echo $meta_id[$dindex]; ?> - <?php echo $meta_name[$dindex]; ?> : <?php echo $meta_value[$dindex]; ?></li>
<?php ?>
<?php ?>
<?php ?>

If you don't want to show meta id delete:
Code: [Select]
<?php echo $meta_id[$dindex]; ?> -from print.php
« Last Edit: September 14, 2017, 02:43:19 am by Francesko »