Advertisement:

Author Topic: [Plugin]Lorem Items  (Read 32831 times)

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
[Plugin]Lorem Items
« on: July 06, 2015, 11:50:09 pm »
Hi Osclass users .
https://market.osclass.org/plugins/miscellaneous/lorem-items-pro_882
How many items do you need ? 100 ? 1000 ? 100 000?
Need some items to fill up an empty theme  ? Wanna do some tests on your new (empty) website? Adding items manually can be really time consuming, the main reasons this plugin was create was to speed up this process.
This plugin will insert items {random [ lorem (title,description)],images,price,country,region,city, user-contact email ,username)}into existing categories .
Keeps track of inserted lorem items,so can be  deleted after few clicks .
Rewritten from scratch !
Custom text ,
Custom Title,
Custom User first name ,
Custom User last name ,
Number of images . 
Upload Images per category .
Handle osclass Custom Fields
Can handle  required fields  from plugins  !!! ( Admin can define them ) .
Item Location .

« Last Edit: May 30, 2017, 10:06:52 pm by Web-Media »

pixellegolas

  • Full Member
  • ***
  • Posts: 224
  • zwappa.se
Re: [Plugin]Dummy Items
« Reply #1 on: July 07, 2015, 03:30:17 pm »
Sound pretty good. Can we add images?

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Dummy Items
« Reply #2 on: July 07, 2015, 04:47:16 pm »
Yes .
There is 6 default images (next version admin can upload default images & more options )
The plugin will choose random 1-3 images (from 6).
You can replace default images with your own . (names,file extension must be kept )
Code: [Select]
1.png 2.png 3.png 4.png 5.png 6.png

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Dummy Items
« Reply #3 on: July 07, 2015, 05:04:12 pm »
the content of  images folder .
upload the pictures OR put your own  png images (1,2,3,4,5,6) small ones (optimized for web )  for faster uploads
« Last Edit: July 07, 2015, 05:14:19 pm by Web-Media »

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Dummy Items
« Reply #4 on: July 07, 2015, 05:09:40 pm »
This is the results from search page

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Dummy Items
« Reply #5 on: July 07, 2015, 05:12:51 pm »
Item page

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Dummy Items
« Reply #6 on: July 08, 2015, 05:30:41 pm »
 Features in  Next plugin version :
  • Insert your own text
  • Choose country
  • Choose category
  • Upload own images
  What do you wanna see   in next version ?                       

Sunkal

  • Sr. Member
  • ****
  • Posts: 445
  • everybody can help?
Re: [Plugin]Dummy Items
« Reply #7 on: July 16, 2015, 05:41:15 pm »
Features in  Next plugin version :
  • Insert your own text
  • Choose country
  • Choose category
  • Upload own images
  What do you wanna see   in next version ?                       

its very god but we need zip code for this plugin.can you make this with zip code please

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2175
  • osclass.work
Re: [Plugin]Lorem Items
« Reply #8 on: July 21, 2015, 03:10:12 pm »
Hi Web-Media,
sorry for late reply, thanks for this plugin, it is very useful.

There are 2 small issues noticed, but not a big deal really: I have noticed that required custom fields will prevent items to be inserted. Also, not sure why on one of my setups it does not properly detect a country (it "detects" something, but it is blank). Didn't have time to look code itself.

Thanks again,
Regards

Hussard (Madhouse)

  • Full Member
  • ***
  • Posts: 214
  • Outlaw web developer & padawan designer.
Re: [Plugin]Lorem Items
« Reply #9 on: July 22, 2015, 10:01:35 am »
Really clever plugin!

Would be nice to be able to fill custom plugin data (the same in every ads).
Can we create items for registered users too?

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Lorem Items
« Reply #10 on: July 22, 2015, 01:14:46 pm »
Hy there  dev101,Hussard  thanks for feedback.
Regarding issues :

a.
Code: [Select]
Custom fields will prevent items to be inserted. Indeed ,plugin does not check for "meta" param  (in this version of the plugin ) .
Problem is required fields from various plugins .
 This fields  are  added by hooks and processed  by each plugin internally .
 Did any of you imagine a way to gather all fields for item post form in a single entry point ?
 lets have a look into  custom attributes plugin
 
Code: [Select]
public function pre_item_post() {
$fields = Params::getParam('fields');
if (!empty($fields) && is_array($fields)) {
foreach ($fields as $id) {
$field = Attributes::newInstance()->getField($id);
$type = $field['s_type'];
$name = 'field_' . $id;
$value = Params::getParam($name);
if ($type == 'checkbox' && empty($value)) {
$value = 'unchecked';
}
Session::newInstance()->_setForm($name, $value);
Session::newInstance()->_keepForm($name);
}
}
}

maybe some  osclass core changes will help us gathering all fields into single entry point .
Code: [Select]
Session::newInstance()->_setItemForm($id_item ,$name, $value,$required);or something similar to check all item fields in 1 place ,required or not
Workarround : drop ItemAction and do the validation inside the  lorem plugin . This will  bypass required fields  and insert Item with no custom required fields .
b.
Code: [Select]
Would be nice to be able to fill custom plugin data
same as above. how do we gather  all item fields related with the procesed item  ?
  from
Code: [Select]
Session::newInstance()->_keepForm($name); ?
from osc_run_hook('post_item'); ? (Item controller )
from ItemActions ?
Code: [Select]
osc_run_hook('pre_item_add', $aItem); ?
how do we validate those fields?
We can add some  optional fields  where admin can add some custom fields  name and  then look for them ?
You are programers , you can look inside other plugins,etc, but there are admins that do not know what to look and where  inside plugins .
That's my  ideas  at 11.24 with no coffee  at breakfast :)
c.
Code: [Select]
Can we create items for registered users too?
I'll include this option in next plugin versions .
Admin to choose between registered,Lorem users.
.............................................................................
Plugin is on github ,so let's improve it .
Some ideas  will push us forward !  ;)

Thanks !
« Last Edit: July 22, 2015, 01:26:43 pm by Web-Media »

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2175
  • osclass.work
Re: [Plugin]Lorem Items
« Reply #11 on: July 22, 2015, 07:08:06 pm »
Hi Web-Media,

No, I haven't thought of a way to do this, and the issue is at least for internal fields that you have to scan entire meta table and get required ones and all available ones from a given (sub)category, which will without a doubt influence the test itself. Unless, you perform this before the timer mark, and later just reuse data. But, it is not a big deal, it may influence accuracy by 2-3% at the most (if there are a lot of ones). Also, there are no ajax requests simulation either (for fields and locations), which also contribute to some amount in the final time. But, overall, it gives you a very good rough estimate, considerable amount of time goes to image processing anyway.

P.S.
I've made a small donation, not much, but for start...

Regards,
dev101

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: [Plugin]Lorem Items
« Reply #12 on: July 22, 2015, 09:20:24 pm »
Thanks dev101 .
Internal  osclass custom fields can be solved .
Timing is not an issue . User can  choose smaller amount of items or limit number of max items at 10 000. On average shared hosting should insert 10 000 items in 7200 sec (with images) .
More problematic are  required fields added by other plugins  into  item post  hooks.
How do we gather  all that fields ?

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2175
  • osclass.work
Re: [Plugin]Lorem Items
« Reply #13 on: July 22, 2015, 09:25:48 pm »
Basic idea:
Quote
if plugin installed > yes > build profile: scan its tables + check required fields

and from there you can figure what type of data is expected (string, number) and generate one. There are only few attributes plugins there, so it should not be hard to cover them all. Again, seems like a lot of trouble for something that will not add much to accuracy, but it can be done.

P.S.
Also, the main reason I am against this is that it will render cross-examination and comparison of the results unusable/questionable, because different setups and configurations will affect generated benchmark results.

Regards
« Last Edit: July 22, 2015, 09:30:50 pm by dev101 »

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [Plugin]Lorem Items
« Reply #14 on: July 22, 2015, 11:49:51 pm »
@Web-Media
Nice one, for images I think it is not hard to do this:
- let's have 500 custom/sample/random images in img folder
- when lorem listing is created, random image is created

It is easy to get 1000 random images from anywhere, then lorem listings will look much universal :)